DEV Community

Discussion on: React Hooks (useContext, useEffect, useState, useRef) Summarized Like Crazy (Short & Concise Article)

Collapse
 
rachelnabors profile image
Rachel Nabors

Nice write up! To clarify, the only way to trigger a render is to use the state setting function (ie setState()). If you update the state variable any other way, it not only won't trigger a rerender, but if something ELSE triggers that rerender, if your variable is a primitive like boolean, number or string, you'll lose your changes with the rerender!💜

Collapse
 
ishakmohmed profile image
Mohmed Ishak • Edited

Yes, totally forgot that. Thanks for reminding me. I'll edit the article. 😄