Layout
- Vite App
- Nextjs App
Not implemented for Create React Application as this is not needed
By default, Next.js is re-rendering the entire UI every time you click on a link.
This is very annonying when you want a common layout between several pages (e.g: a common navbar) because the state is lost when navigating between pages
This is very annonying when you want a common layout between several pages (e.g: a common navbar) because the state is lost when navigating between pages
This is very well explain in this article and Oneki.js implements the solution proposed.
To avoid an unmount / mount of the layout when transitioning between pages, Oneki.js proposes the following HOC:
const PageWithLayout = withLayout(Page, Layout)