Skip to content

Tag: next.js

Clicking on next/link causing an issue in getInitialProps

I’m trying to add a link to redirect users to the create page, But when I clicked on the link I got the following error: Link code : getInitialProps // _app.tsx Answer You have to write isomorphic code inside MyApp.getInitialProps because that code can run both on the server (during first page load) or …

Css not loading properly in Reactjs

I am working in reactjs and using (Nextjs) framework,I have All “css,js,images” in “public” folder and in “_app.js” i included all these files,But i whenever i tyring to open “Main page” in browser then page is not displaying (only loader showing) , In other wor…

Updating the localStorage is not in sync

When I toggle darkmode it doesn’t update in _app unless I have 2 tabs opened and trigger it in one tab, then the other tab gets updated and darkmode is toggled, but not the tab I pressed the toggle. I use useSettings in both index and _app. I recorded a video so it’s easier to see what’s goi…

How to redirect to another page using on keypress in nextjs?

I need to redirect users using onkeypress in nextjs. I have a search input where users can type and then press enter key to go to the other page. What I’ve tried: i would appreciate your help. Answer You can use the useRouter hook from next – https://nextjs.org/docs/api-reference/next/router Try c…

How to render data from parse in next-auth

I want to render data in client side below from parse after signin from next auth using useSession But it’s just render email This is my callbacks code And client side code I don’t know how to change my callbacks code to display data from database Answer After a while and try harder, I was success…