question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Can't use React hooks inside Konva component tree

See original GitHub issue

If I use a React hook inside the Konva component tree I’m getting the following error:

Hooks can only be called inside the body of a function component.

I’m using 16.8.0-alpha.1.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:2
  • Comments:11 (5 by maintainers)

github_iconTop GitHub Comments

3reactions
lavrtoncommented, Jan 31, 2019

I am going to wait for a public release of React, so we can update dependencies and have hooks support too. Please just wait.

1reaction
lavrtoncommented, Feb 6, 2019

Just made a prelease 16.8.0-1 with the support of Hooks.

npm install react-konva@next

Please try it. Will publish with latest tag later.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Render DOM elements inside a canvas stage - Konva
If you want to have some DOM nodes as part of your canvas tree you can use <Html /> component from react-konva-utils package....
Read more >
reactjs - Error when use react-konva - Stack Overflow
I just install react-konva and read document follow to test some feature but can't use it. An error occurs in the component stage,...
Read more >
You Can't Call Hooks Inside Conditions? Yes you can
Calling hooks conditionally breaks the rules, yes. Wrap the hook with a component and render that component optionally to toggle the usage of ......
Read more >
Make a diagram creation tool in React #2: Intro to React Konva
Code: https://codesandbox.io/s/quizzical-darwin-zhm7n?file=/src/App.js The google slide: ...
Read more >
invalid hook call. hooks can only be called inside of the body ...
If you think back in the class component version, your code is calling this.setState in the render() ... Cant use Hooks with my...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found