Quantcast
Channel: ReactJS - Does render get called any time "setState" is called? - Stack Overflow
Viewing all articles
Browse latest Browse all 11

Answer by Danny Harding for ReactJS - Does render get called any time "setState" is called?

$
0
0

It seems that the accepted answers are no longer the case when using React hooks. You can see in this code sandbox that the class component is rerendered when the state is set to the same value, while in the function component, setting the state to the same value doesn't cause a rerender.

https://codesandbox.io/s/still-wave-wouk2?file=/src/App.js


Viewing all articles
Browse latest Browse all 11

Latest Images

Trending Articles





Latest Images