10.0.0-alpha.0 - Hook useEffect never gets called
See original GitHub issueWhen using a code like this in 10.0.0-alpha.0:
import { useEffect } from 'preact/hooks';
function Component(props) {
useEffect(() => {
console.log('effect');
});
return <div> test </div>;
}
The console log never gets called. I’m having a hard time getting preact functional components to work in codesandbox or I’d have posted a repro, sorry about that.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:5
- Comments:7 (3 by maintainers)
Top Results From Across the Web
useEffect not being called and not updating state when api is ...
I'm fetching data from a weather api using useEffect hook and declaring the dependency correctly as well. My state ...
Read more >Preact on Twitter: "⚛️ Preact X is now in alpha!! Fragments ...
Wow, this is awesome! I believe that useEffect is broken though, it never gets called where as the same code runs fine in...
Read more >Hooks API Reference - React
Hooks are a new addition in React 16.8. They let you use state and other React features without writing a class. This page...
Read more >Get Hooked on React! | Object Computing, Inc.
Get Hooked on React! ... Hooks are a feature added in React 16.7.0-alpha.0. ... An effect is configured by calling the useEffect function,...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Can confirm, just tried it out with the code in
master
and the issue is fixed there 🎉I think this might be fixed in master. I was seeing similar behavior and submitted #1320 to fix my issue. Hopefully it fixes this one.