NEXTJS: getServerSideProps not working into components

You cannot use getServerSideProps in non-page components. You can either pass the prop from Home to HomeSection or create a context so the value can be available globally from the component tree getServerSideProps can only be exported from a page. You can’t export it from non-page files.

useRouter/withRouter receive undefined on query in first render

I found something: isReady: boolean – Whether the router fields are updated client-side and ready for use. Should only be used inside of useEffect methods and not for conditionally rendering on the server. And the code would be like: const router = useRouter(); useEffect(()=>{ if(!router.isReady) return; // codes using router.query }, [router.isReady]);

How to add new pages without rebuilding an app with +150k static pages?

That can be achieved with getStaticProps/getStaticPaths. You’ll have to use fallback: true or fallback: ‘blocking’ in getStaticPaths. With fallback: true the paths not generated at build time will serve a fallback page on the first request while Next.js statically generates the page. When this is done the page will be swapped from the fallback page … Read more