Is there a working demo with NextJS?
dpyzo0o opened this issue · comments
dpyzo0o commented
More specifically, I would like to consume some global values in getInitialProps
but then I would get this error Error: Invalid hook call. Hooks can only be called inside of the body of a function component.
. e.g with redux, I'm able to access the redux store inside getInitialProps
. Any ideas that could achieve this?
Haz commented
It's not possible to use it outside of the render phase of React components. What you can do, though, is creating your initial state in getInitialProps
and then pass it to React Context in the render phase like this: #68 (comment)