Skip to content
Advertisement

Tag: next.js

How can I add animation to react state

I just want to add a fade in animation to next index. i found a package called “react transition group” but all tutorials were based on class components or redux I didn’t understand anything. Answer SwitchTransition waits for the old child to exit then render the new child as mentioned in the react transition group website. there are two modes:

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 across components in the first place,

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 /midterm/cs611 it shows 404 page. If i replace like ‘midterm’

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? Answer sort function alters your

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 could find anything similar in their documentation. Thanks. Answer The easiest way is to abstract the content from the page level. No need

Advertisement