DEV Community

Discussion on: ReactJS -- If it is setting a state with the same value, will the component be re-rendered?

Collapse
 
andreabarghigiani profile image
Andrea Barghigiani

It's just me or it re-render the function component with Hooks as well? Tryed on both to set the new value to an integer (20) and still re-render both of them 🤔

Collapse
 
smac89 profile image
smac89

The example given there is not correctly done.

Here is an updated example which uses useEffect and also shows the last time the component was updated

stackblitz.com/edit/react-xeofau

Collapse
 
fidaay profile image
fidaay

That's the same thing lol