No layout
Simple
GetInitialProps
GetServerSideProps
GetStaticProps
UseInitialProps
No layout
Click me to update state: (0)
This is default Nextjs behaviour. No state is persisted when navigating between pages using the same layout.
Index
Page2
Page3
Page2
Click me to update state: (0)
Page2