Skip to content

Commit b4b5894

Browse files
fix(overmind-react): throw proper error when missing provider
1 parent e4fa957 commit b4b5894

File tree

1 file changed

+6
-0
lines changed
  • packages/node_modules/overmind-react/src

1 file changed

+6
-0
lines changed

packages/node_modules/overmind-react/src/index.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,12 @@ export const createHook = <Config extends IConfiguration>(
9292
Config
9393
>
9494

95+
if (!overmind) {
96+
throw new Error(
97+
'You are not exposing Overmind on the React context. Please make sure you use the Provider, as shown in the React guide'
98+
)
99+
}
100+
95101
if ((overmind as any).mode.mode === MODE_SSR) {
96102
return {
97103
state: overmind.state,

0 commit comments

Comments
 (0)