I have a problem on codesandbox, that is not reproducable in normal setup.
The error is: "Invalid hook call. Hooks can only be called inside of the body of a function component." - invariant 321
- I only use function components
- There actually was a problem in a dependency (DraftJS)
- Downgraded react and react-dom to 16.12 - where the error was not existing
- Removed the DraftJS dependency mounting at all (removed the schema
widget: 'Text'
) - Removed some other call - to setState, not a hook - inside a setTimeout
- Checked the
package-lock.json
,react
andreact-dom
are the same version
The error still exists in the sandbox, when installing offline no error comes up at all.
Error was primary triggered from src/Schema/DemoEditor.js
- changed sandbox (no DraftJS mounting, no setTimeout): https://codesandbox.io/s/youthful-lalande-w8cvz
- org. sandbox: https://codesandbox.io/s/github/ui-schema/demo-cra
- github project: https://github.com/ui-schema/demo-cra