Skip to content

Tag: next.js

Nextjs: set priority for useEffect

This is my _app.tsx And this is my index.tsx So, in my console print 21 But I want to print 12 How can I set priority for useEffect for run _app first? Answer Short Answer You can’t set priority across components. Long Answer Disregarding why someone would need control over the priority of useEffect acr…

Pass multiple values to a param in getStaticPaths() in nextjs

I want to have two routes /midterm/cs611 /finalterm/cs611 All i am trying to do is when i hit endpoint /midterm/cs611 it should display different content and when it hits to /finalterm/cs611 it should display different content. But i end up with correct results when hitting /finalterm/cs611 and when i hit /mi…

Why is getServerSideProps data being changed?

I’ll fetch data from an API, When I pass my getServerSideProps data to index.js, the prop array is in order by rank. [1,2,3..etc]. ex: data When I alter that data into a different variable, for example: console log shows data is now sorted by price too, when I only wanted topPrice to be sorted, why? Ans…

NextJS render content from a different page

I’ve two routes like, app/products => pages/products/index.js app/products/1 => pages/products/[page].js Here both app/products and app/product/1 will render the same content (same product items), is it possible to render app/products/1 content in app/products without writing duplicate code? I cou…