-
Hi, By following NextJS examples, I'm aware that calls to Router.push/replace should be wrapped into
over
Can someone clarify as to why one pattern should be used over another? Or are they both correct? Thank you |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
This is related to React lifecycle and not Next.js. If you write code within |
Beta Was this translation helpful? Give feedback.
This is related to React lifecycle and not Next.js.
When states or giving props are changed in ancestor components of the component, the render function of the component is recalled every time even if the same props are given.
If you write code within
if
statements in render functions directly, they are called many times more than expected.