Our great sponsors
- The big problem is that Next codebases are set up on a per-page basis, rather than the global app setup you see in CRA or React Native. So, the Redux store setup also has to be per-page if there's different reducer logic.
- There's an assumption that you probably want to use Redux to do some SSR rendering, and then pass the initial state to rehydrate the store on the client as well. That's where tools like https://github.com/kirill-konshin/next-redux-wrapper come in.
-
SurveyJS
Open-Source JSON Form Builder to Create Dynamic Forms Right in Your App. With SurveyJS form UI libraries, you can build and style forms in a fully-integrated drag & drop form builder, render them in your JS app, and store form submission data in any backend, inc. PHP, ASP.NET Core, and Node.js.
I guess that's what I meant by it not being a mistake. There's plenty of valuable lift that Next provides other than the things I mentioned. I don't think that it would be the "wrong" choice based off what you described. I guess I just mean that SSR, built-in API routes are two things that make Next special. If you're not using those, I think it's worth it to look into other frameworks like Gatsby or even starting off simply with Create React App and exploring from there.
Since then, though, I've been working towards moving us over to a new Next.js subproject as the long-term migration plan. Right now I've got Next proxied behind the existing Express backend, and I'm using s to show Next-rendered UI inside of the legacy client. Working great so far. (I've been wanting to do a blog writeup on this for months, but haven't had time.)
I actually hadn't ever tried to use Redux with Next at all until just recently, when I added it to one specific page in the new client. My impressions are:
In our case we don't have any SSR or SSG going on. I ended up borrowing some store setup logic from the existing
withRedux
andwithReduxToolkit
examples in the Next repo, but skipped all the store persistence stuff.So, it's doable, but there's a couple additional aspects to consider beyond what you'd see in a CRA project.
Now I will admit, initial setup of some libraries may be more complex with the addition of having a server side to your project, but most everything has an example from their repo that you'd need https://github.com/vercel/next.js/tree/canary/examples
Related posts
- Building a High-Performance Website with Next.js and WordPress
- The Current State of React Server Components: A Guide for the Perplexed
- My open source project got stolen by a HN user
- Finding the Best React CMS: A Comprehensive Guide
- [AskJS] Frameworks are often unnecessary (i got the suspicion by watching some YouTube videos that who advocates for frameworks and against vanilla JavaScript at the same time did not learn vanilla web technologies very well) what do you think? (Read the body)