| 278 | } |
| 279 | |
| 280 | function useState<S>( |
| 281 | initialState: (() => S) | S, |
| 282 | ): [S, Dispatch<BasicStateAction<S>>] { |
| 283 | const hook = nextHook(); |
| 284 | const state: S = |
| 285 | hook !== null |
| 286 | ? hook.memoizedState |
| 287 | : typeof initialState === class="st">'function' |
| 288 | ? class="cm">// $FlowFixMe[incompatible-use]: Flow doesn't like mixed types |
| 289 | initialState() |
| 290 | : initialState; |
| 291 | hookLog.push({ |
| 292 | displayName: null, |
| 293 | primitive: class="st">'State', |
| 294 | stackError: new Error(), |
| 295 | value: state, |
| 296 | debugInfo: null, |
| 297 | dispatcherHookName: class="st">'State', |
| 298 | }); |
| 299 | return [state, (action: BasicStateAction<S>) => {}]; |
| 300 | } |
| 301 | |
| 302 | function useReducer<S, I, A>( |
| 303 | reducer: (S, A) => S, |