DEV Community

CodeWithKenn
CodeWithKenn

Posted on

3 2

NEXTJS: getServerSideProps not working into components

Hey, Guys!

This is Kenn here, from CodeWithKenn.
From today, you'll be seeing many React/Next/Gatsby related bugs solved, just decided to add a kind of bugs Documentation style.

Because, I ended up searching for the same bugs after months (I don't remember what the solutions were). So, I decided to start documenting it here on Dev.to

This helps me to save some time and be more productive.

So, Feel free to follow if you're interested! Peace ;)

Bug Info

NEXTJS: getServerSideProps not working into components

Bug Solution

You cannot use getServerSidePropsin non-page components.

getServerSidePropscan only be exported from a page. You can’t export it from non-page files.

πŸ‘‰ More Details

Let's Connect

Want to start blogging? πŸ”₯Join NOW!

Heroku

This site is built on Heroku

Join the ranks of developers at Salesforce, Airbase, DEV, and more who deploy their mission critical applications on Heroku. Sign up today and launch your first app!

Get Started

Top comments (0)

Billboard image

Create up to 10 Postgres Databases on Neon's free plan.

If you're starting a new project, Neon has got your databases covered. No credit cards. No trials. No getting in your way.

Try Neon for Free β†’

πŸ‘‹ Kindness is contagious

Please leave a ❀️ or a friendly comment on this post if you found it helpful!

Okay