Rendering the app tree during getDataFromTree(<App />) appears to break React Hooks, causing an invariant violation to be thrown.
UnhandledPromiseRejectionWarning: Invariant Violation: Hooks can only be called inside the body of a function component.
| at invariant (webpack://%5Bname%5D_%5Bhash%5D/./node_modules/react/cjs/react.development.js?:125:15)
| at resolveDispatcher (webpack://%5Bname%5D_%5Bhash%5D/./node_modules/react/cjs/react.development.js?:1450:28)
| at useState (webpack://%5Bname%5D_%5Bhash%5D/./node_modules/react/cjs/react.development.js?:1473:20)
Rendering the same app tree using renderToString(<App />) works just fine.
react-apollo - v2.2.4
apollo-boost - v0.1.17
react - v16.7.0-alpha.0
react-dom - v16.7.0-alpha.0
graphql - v14.0.2
Fixed in [email protected]!
Works with [email protected], but breaks with [email protected].
@mhaagens Hooks are not enabled on v16.7.0 release
Hey guys,
I have [email protected] (tried it with next and 2.3.1) with react && reactDom 16.7.alpha.2 and getDataFrom still fails on the server. Is there anything I might have missed?
Cheers!
Having the same issue with React 16.8.4 and @apollo/react-ssr.
Looking at this thread https://github.com/facebook/react/issues/14022#issuecomment-515755059 make me anxious. Is there really no solution?
Most helpful comment
Hey guys,
I have [email protected] (tried it with next and 2.3.1) with react && reactDom 16.7.alpha.2 and getDataFrom still fails on the server. Is there anything I might have missed?
Cheers!