Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to gatsby@2.18.5 getting Error: Invalid hook call. in StoreStateProvider #19864

Closed
zanehiredevs opened this issue Nov 28, 2019 · 2 comments

Comments

@zanehiredevs
Copy link

Did anything change with regards to state or hooks? I can't build after updating gatsby to 2.18.5 here is the stacktrace. We're using mobx through the standard wrap-with-provider. We aren't using hooks much and those all seem to be implemented properly.

error The above error occurred in the <StoreStateProvider> component:
    in StoreStateProvider
    in App

React will try to recreate this component tree from scratch using the error boundary you provided, App.
error Warning: App: Error boundaries should implement getDerivedStateFromError(). In that method, return a state update to display an error message or fallback UI.
error UNHANDLED REJECTION


  Error: Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:
  1. You might have mismatching versions of React and the renderer (such as React DOM)
  2. You might be breaking the Rules of Hooks
  3. You might have more than one copy of React in the same app
  See https://fb.me/react-invalid-hook-call for tips about how to debug and fix this problem.
  
  - react.development.js:1590 resolveDispatcher
    [bambooasia]/[gatsby]/[react]/cjs/react.development.js:1590:13
  
  - react.development.js:1618 useState
    [bambooasia]/[gatsby]/[react]/cjs/react.development.js:1618:20
  
  - context.js:17 StoreStateProvider
    [bambooasia]/[gatsby]/[gatsby-cli]/lib/reporter/loggers/ink/context.js:17:41
  
  - react-reconciler.development.js:6036 renderWithHooks
    [bambooasia]/[react-reconciler]/cjs/react-reconciler.development.js:6036:18
  
  - react-reconciler.development.js:8570 mountIndeterminateComponent
    [bambooasia]/[react-reconciler]/cjs/react-reconciler.development.js:8570:13
  
  - react-reconciler.development.js:9938 beginWork$1
    [bambooasia]/[react-reconciler]/cjs/react-reconciler.development.js:9938:16
  
  - react-reconciler.development.js:11563 Object.invokeGuardedCallbackImpl
    [bambooasia]/[react-reconciler]/cjs/react-reconciler.development.js:11563:10
  
  - react-reconciler.development.js:11740 invokeGuardedCallback
    [bambooasia]/[react-reconciler]/cjs/react-reconciler.development.js:11740:31
  
  - react-reconciler.development.js:15778 beginWork$$1
    [bambooasia]/[react-reconciler]/cjs/react-reconciler.development.js:15778:7
  
  - react-reconciler.development.js:14696 performUnitOfWork
    [bambooasia]/[react-reconciler]/cjs/react-reconciler.development.js:14696:12
@vladar
Copy link
Contributor

vladar commented Nov 28, 2019

Seems related: #19827 (comment)

@zanehiredevs
Copy link
Author

Yup removing direct installations of react and react-dom fixed it thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants