Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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.


What do you mean? When props change the component re-renders, doesn't it?


No, 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-...


The 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.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: