victory
victory copied to clipboard
Invalid hook call when I tried the tutorial
To whom it may concern,
I was experimenting the tutorial on victory. While I was able to draw the bar chart, the following issue came when I tried to wrap VictoryBar with VictoryChart. Any suggestions are appreciated! Thanks!
Best, Wenjin
react.development.js:1476 Uncaught 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:
- You might have mismatching versions of React and the renderer (such as React DOM)
- You might be breaking the Rules of Hooks
- You might have more than one copy of React in the same app See https://reactjs.org/link/invalid-hook-call for tips about how to debug and fix this problem. at resolveDispatcher (react.development.js:1476:1) at Object.useState (react.development.js:1507:1) at Module.useAnimationState (use-animation-state.js:33:1) at VictoryChartImpl (victory-chart.js:28:1) at renderWithHooks (react-dom.development.js:16305:1) at mountIndeterminateComponent (react-dom.development.js:20074:1) at beginWork (react-dom.development.js:21587:1) at HTMLUnknownElement.callCallback (react-dom.development.js:4164:1) at Object.invokeGuardedCallbackDev (react-dom.development.js:4213:1) at invokeGuardedCallback (react-dom.development.js:4277:1)
Someone else also had a similar issue here: https://stackoverflow.com/questions/72940866/react-victorychartimpl-invalid-hook
Hi @Hendricks27 – I'm trying to reproduce this, but am not getting this error. Would you share which version of Victory you're using?
Hi. I'm having the same problem. Version used:
"victory-native": "^35.3.3"
I had quite similar issue after upgrading my expo app to 48. The app kept crashing with Error: Invalid hook call
even though the library has been running without a single issue for ages. victory-native
at that time was "victory-native": "^35.3.2".
Then I initiated a new clean expo project with the latest victory-native
version "^36.6.8" and react-native-svg
"^13.9.0" installed. It runs the official tutorial demo perfectly. More importantly, I noticed that the new app does not have react-dom
After that, I copied the versions of victory-native
, react-native-svg
, react-native
and expo
to my current project and remove react-dom
from package.json. it works like a charm.
Hope this may help someone who is struggling with this.
This issue is stale because it has been open for 90 days with no activity. If there is no activity in the next 7 days, the issue will be closed.
This issue was closed because it has been inactive for 7 days since being marked as stale. Please open a new issue if you believe you are encountering a related problem.