Redux Best Practices

This page summarizes the projects mentioned and recommended in the original post on dev.to

Our great sponsors
  • Appwrite - The Open Source Firebase alternative introduces iOS support
  • SonarLint - Clean code begins in your IDE with SonarLint
  • Scout APM - Less time debugging, more time building
  • Immer

    Create the next immutable state by mutating the current one

    It is fully written in Typescript and is highly recommended that Redux Toolkit is used instead of the original Redux when using it for managing global state. It offers a flexible API, making it possible for making the state management scalable without having to worry about the limits of the library. One of the key concepts of Redux is immutability, and Redux Toolkit makes it easier than ever to keep the immutability by already setting up the ImmerJS library internally, so the developer does not have to worry about accidentally modifying the state directly. One of the most noticeable things for developers when switching to Redux Toolkit is the way reducers are created. Previously we used action creators and created a reducer where we handled all the actions. Now we can use the createSlice API to create reducers and it will eliminate the need to write action creators by creating them for you. An example of createSlice can be seen below:

  • redux-devtools

    DevTools for Redux with hot reloading, action replay, and customizable UI

    When an action is dispatched, all of the reducers will be notified and every single one of them will check if they can handle the action. Not only that, but the Redux dev tools will be a mess trying to see what action was fired when. That’s why we should try to think of actions as events that happened and not what the action is changing. For example, we should rather have an action called userLoggedIn than setUserId.

  • Appwrite

    Appwrite - The Open Source Firebase alternative introduces iOS support . Appwrite is an open source backend server that helps you build native iOS applications much faster with realtime APIs for authentication, databases, files storage, cloud functions and much more!

  • redux-toolkit

    The official, opinionated, batteries-included toolset for efficient Redux development

    Redux Toolkit is a wrapper library written for the original Redux for the sake of making it easier, and faster to use Redux by reducing the boilerplate and introducing features such as thunks out of the box without having to install third-party libraries.

  • redux

    Predictable state container for JavaScript apps

    Redux is a library used for global state management, meaning if you have a piece of state that you want to access in different places of your app, you can use Redux to manage that state and make it easily accessible anywhere. The global state can be anything from logged-in user information to UI state such as theme, etc.

  • React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

    Redux is being used a lot together with React apps, however, it is possible to use Redux with any other library. Make sure you check out this tutorial on how to use Redux with React.

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts