News for hackers. Stuff that matters.
Re:Next.js 10.2 by matthoiland on Wednesday April 28, 2021 @11:53AM (#26970784)
Hey Lee, thank you for all your work! Big company here in Portland, and we just went all in on Next.js – so far our development speed has increased, and junior devs are easily onboarded.

One request would be an official state management extension – coming from Vue and Vuex, this is something I miss. We're currently using Redux Toolkit, but would be great to have something official for Next along the lines of Vuex, Reframe, or Elm.

* update (writing this between lots of meetings :| )

One huge value we get from Next is the opinions and conventions. Large dev teams benefit from this – which is why we've been using Ember and Ember Data for years, and Rails before that.

Having an opinionated state management that plays nicely with Next on the client AND the server is what I'd like to see. We're doing quite a few workarounds currently with Redux to support managing state from within the components and during `getServerSideProps`. If all my dreams came true, it would be nice to persist state conditionally in Redis or Mongo.

Sorry for the rambling thoughts – just loving Next, and incredibly busy building our new core IP with it.

Re:Next.js 10.2 by NoNonsense118 on Wednesday April 28, 2021 @12:22PM (#26971144)
Vercel has a library for state management that's similar to React Query. https://swr.vercel.app/.
Re:Next.js 10.2 by leerob on Wednesday April 28, 2021 @12:56PM (#26971563)
Note this is specifically for server caching state: https://leerob.io/blog/react-state-management
Re:Next.js 10.2 by leerob on Wednesday April 28, 2021 @12:55PM (#26971553)
Hey! Thanks for the kind words and glad you're enjoying Next.js. It's (basically) impossible for us to recommend a _single_ state management solution for all users, because state management means different things to different folks. Depending the industry and scale of your application, it also changes your state management needs.

I wrote an in-depth guide on this here: https://leerob.io/blog/react-state-management

Re:Next.js 10.2 by tony_landis on Wednesday April 28, 2021 @11:58AM (#26970835)
I like having the choice, for us immer and context usually is all we need beyond state & props so would not like to be forced into something opinionated. Free to choose just like you decide how to interface with your backend/state. Don’t turn this into a rails or danjo, please :)
Re:Next.js 10.2 by matthoiland on Wednesday April 28, 2021 @12:06PM (#26970939)
I totally understand. The old Redux adage is "don't use it until you need to". Most apps won't need a big, opinionated state management – but when you do, it's nice having something robust, verbose, opinionated, and rails or django-like.
Re:Next.js 10.2 by monic on Wednesday April 28, 2021 @12:05PM (#26970920)
What kind of deep integration are you looking for with a preferred state framework?
Re:Next.js 10.2 by matthoiland on Wednesday April 28, 2021 @12:45PM (#26971416)
If I closed my eyes and designed the API first, it would look like the `/pages` convention – just add state "slice" files in `/store` (like `src/store/user.ts`) and then use either React hooks inside the component (like `useStore` or `useMutation`) or use something (like `getServerSideState`) on the server.

Your state "slices" would export initial state, types (optionally), and an object containing getters, setters, and mutations (using Vuex concepts).