3 ms·
True, this is some really unfortunate wording. Since functional components don't have lifecycle methods anymore, relying on useEffects is pretty much the only w
by ricardobayes 4y ago
True, this is some really unfortunate wording. Since functional components don't have lifecycle methods anymore, relying on useEffects is pretty much the only way to subscribe to a prop change and render/handle its change.
Now according to the new docs, advocating to go "local variables" way feels a bit non-React to me, actually.
- MrPatan 4y agoWhat do you mean? When props change the component re-renders, doesn't it?
- ricardobayes 4y agoNo, it doesn't, a component re-renders when its state changes or its parent re-renders. https://blog.isquaredsoftware.com/2020/05/blogged-answers-a-mostly-complete-guide-to-react-rendering-behavior/#standard-render-behavior https://blog.isquaredsoftware.com/2020/05/blogged-answers-a-...
- MrPatan 4y agoThe article you link says that a component will rerender when its parent rerenders or state changes. It doesn't say anything about the props changing. If you read this sentence "In normal rendering, React does not care whether "props changed" - it will render child components unconditionally just because the parent rendered!" and understood that react doesn't re-render a component when its props change, well, I read that sentence in a different way.