Our great sponsors
-
Recoil
Recoil is an experimental state management library for React apps. It provides several capabilities that are difficult to achieve with React alone, while being compatible with the newest features of React.
-
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.
-
react-hook-thunk-reducer
📡 A React useReducer() hook whose dispatcher supports thunks à la redux-thunk.
Regarding Recoil; I agree that it can be easy for simple state (like useState) but it is not trivial for complex state like syncing with Atom effects, which are currently unstable and have limitations.
I created my own “global state” management library: https://github.com/baron816/Galactic-State. It takes 30 seconds to learn, is very lightweight and ergonomic, and should solve performance issues with Context. Please check it out.
Attention: Do not begin a project with Redux Form. The author of Redux Form has written a superior library, React Final Form. If you have already started using Redux Form, there is a migration guide.
I've been playing around with useReducer and useContext and it was trivially easy to implement a functional action/reducer system that worked just like redux but glued together with react built-ins. I'm also not sure what the difference between a custom hook and a middleware is, they seem like the same thing to me. Custom hooks are easy to implement, for example here's the equivalent to a thunk "middleware": https://github.com/nathanbuchar/react-hook-thunk-reducer/blob/master/src/thunk-reducer.js. You can keep wrapping your reducer in as many custom hooks as you like to handle whatever side-effects you need, just like you can with redux middleware.
Use zustand. About as bare bones as you can get. Creator of react query uses it https://twitter.com/tannerlinsley/status/1293640999533568000?s=21 and it’s probably going to be added to react itself https://github.com/facebook/react/pull/20646
I’m missing the rtk-query library (data fetching similar to react-query for redux): https://rtk-query-docs.netlify.app/
Related posts
- How do you handle very big forms?
- Very ambivalent to nextjs coming from Django
- How can I render the initial values of redux-form field arrays?
- What is the best practices for creating multi-step form?
- What would make you use (or not) a tool like JSON Forms for your apps? I'm asking cause I want to learn how to evaluate tooling