Image for post
Image for post
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. 🚀

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store