componentDidMount not called in a specific case
See original GitHub issueThe lifecycle hook componentDidMount
does not get called for components that return false form shouldComponentUpdate
and are wrapped in a normal component
see repro: http://jsfiddle.net/2sh26um7/4/ (4.8.0) http://jsfiddle.net/48e5jdsk/2/ (5.0.0-beta5)
the beta fixes the immediate issue from 4.8.0 but if you wrap the component twice the same problem happens
click the toggle button 4 times in console you will see mount unmount unmount the expected log would be mount unmount mount unmount
if you remove the wrapper the log is correct
If there is anything I can help with please let me know
Issue Analytics
- State:
- Created 7 years ago
- Comments:5 (5 by maintainers)
Top Results From Across the Web
react componentDidMount not firing - Stack Overflow
I set up a new react project and for some reason, the componentDidMount method is not being called.
Read more >React Lifecycle Methods Render And ComponentDidMount
componentDidMount () method is the perfect place, where we can call the setState() method to change the state of our application and render()...
Read more >componentDidMount not called in a specific case #172 - GitHub
The lifecycle hook componentDidMount does not get called for components that return false form shouldComponentUpdate and are wrapped in a ...
Read more >ReactJS componentDidMount() Method - GeeksforGeeks
The componentDidMount() method allows us to execute the React code when the component is already placed in the DOM (Document Object Model).
Read more >Rendering and Updating Data using Component Lifecycle ...
Let's look at a use case that shows how to render something when the component is added into the rendering phase. We'll use...
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
Yes,
5.0.0-beta6
fixes the mount event. It looks like it might duplicate the unmount event though, looking into that now.@kruczy + @zhenkunou - Forgot to tag the commit with this issue, but I’ve published what I hope is a proper fix for this. It fixes the repro: http://jsfiddle.net/developit/48e5jdsk/7/
Closing as hopeful for now but let me know if you have other cases/repros that are still affected!