Setup Next.js with Redux 🔥

RadicalLoop
1 min readMar 2, 2020

Next.js + Redux Setup

Next.js is awesome library for SSR(Server Side Rendering). We are developing our website with strapi and Next.js.

So, We wanted to use redux in Next.js project. Setup is easy but after redux setup, “getInitialProps” method stopped working for pages.

We did research on that and found out solution for it. Basically, we had to overwrite “App” component from Next.js.

To overwrite “App” component from Next.js, you would require to create “_app.js” file. Here it is.

_app.js

And now, getInitialProps method should call and you’ll get store in the method. Checkout index.js page.

index page (index.js)

Cool, now you you can leverage the power of redux and next.js both in our Next application.🔥🔥🔥

If you enjoyed reading this blog post, please click on the clap button below! ❤️👇

Follow RadicalLoop on Twitter, Facebook. 🚀

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

No responses yet

Write a response