3 ms·
The instance of the class isn’t destroyed every render... you can keep other state on it too that is persisted between renders, changing it just won’t trigger a
by zwily 7y ago
The instance of the class isn’t destroyed every render... you can keep other state on it too that is persisted between renders, changing it just won’t trigger a render.
- nightski 7y agoSure that is the way it works now. Is that a guarantee of React though or implicit behavior that could change in the future?
- boubiyeah 7y agoIt's just an implementation detail.
- deleted 7y ago[deleted]
- TomMarius 7y agoYou are right. I tried it here, for others: https://codesandbox.io/s/crazy-bush-cg2i0?file=/src/App.js https://codesandbox.io/s/crazy-bush-cg2i0?file=/src/App.js