Skip to content

Commit

Permalink
fix(overmind-react): fix React 18 detection
Browse files Browse the repository at this point in the history
  • Loading branch information
henri-hulski committed Jul 9, 2023
1 parent fcf3f15 commit 18c1d83
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions packages/overmind-react/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import * as react from 'react'

import {
ENVIRONMENT,
EventType,
Expand All @@ -7,7 +9,6 @@ import {
Overmind,
OvermindMock,
} from 'overmind'
import * as react from 'react'

const IS_PRODUCTION = ENVIRONMENT === 'production'
const IS_TEST = ENVIRONMENT === 'test'
Expand Down Expand Up @@ -359,8 +360,8 @@ export interface StateHook<Context extends IContext<{}>> {
export const createStateHook: <
Context extends IContext<{ state: {} }>
>() => StateHook<Context> = () =>
// @ts-ignore
react.useSyncExternalStore ? useStateV18 : useState
// eslint-disable-next-line dot-notation
typeof react['useSyncExternalStore'] === 'function' ? useStateV18 : useState

export const createActionsHook: <
Context extends IContext<{ actions: {} }>
Expand Down

0 comments on commit 18c1d83

Please sign in to comment.