Learning how to use redux - a state management library

Related tags

React redux
Overview

Redux

Learning how to use redux - a state management library

What is Redux?

Redux is a state management library for JS apps.

It centralizes application's state, and hence makes data flow transparent and predictable.

Why is Redux needed?

In certain applications with complex UI (e.g. think of a webpage with 5 components), sometimes state/data is needed to be passed on from one component to another.

It can get very difficult to keep track on the flow of the state/data from one component to the other.

Using Redux, we store all the application state in a central repository which essentially is a Javascript object called the 'store'.

Hence different pieces of UI will no longer need to maintain their own state. They instead get what they need from the store.

Any updates to the state/data in the store is done there (at the store) directly.

When is Redux NOT NEEDED?

Before using Redux in your projects, think whether you really need redux or not first, before introducing it into your codebase.

Redux is generally not needed for:

  • Small to medium-size apps, with simple UI or data flow
  • Tight budget or tight deadlines (Redux introduces additional complexity to your code)
  • Static data (e.g. fetch data from API and display it)

Redux Architecture

Redux Architecture

Useful extension

Redux Devtools is a useful chrome extension to debug redux apps.

It can show you:

  • a) your application's state tree,
  • b) actions performed in the app (left side),
  • c) and if you select a particular action, and click on the 'action' tab, you can see the data associated with that particular action,
  • d) Go back to a previous action and restore the UI in that state (time travel debugging)

References

Mosh's Youtube Tutorial - Redux Crash Course: https://www.youtube.com/watch?v=poQXNp9ItL4

You might also like...

use this to replace redux,you can use useActions to change context value and useActions return a mutable function collection

English | ไธญๆ–‡ NOTE react-context-mutation is a lighter and more convenient state manager designed for react applications. It aims to replace the Redux

Feb 22, 2022

๐Ÿ–ฑor โŒจ๏ธ? ๐Ÿคทโ€โ™€๏ธ, but hopefully use-hover-state works on the "user intent" not the "device"

useHoverState() The one aware of keyboard navigation as well ๐Ÿ˜‰ npm i use-hover-state A React hook for tracking user interaction with the DOM elements

Aug 11, 2022

React + Redux starter kit / boilerplate with Babel, hot reloading, testing, linting and a working example app built in

React + Redux starter kit / boilerplate with Babel, hot reloading, testing, linting and a working example app built in

A comprehensive starter kit for rapid application development using React. Why Slingshot? One command to get started - Type npm start to start develop

Dec 22, 2022

Next-gen, highly customizable content editor for the browser - based on React and Redux and written in TypeScript. WYSIWYG on steroids.

ReactPage ReactPage is a smart, extensible and modern editor ("WYSIWYG") for the web written in React. If you are fed up with the limitations of conte

Jan 6, 2023

Starter Antd 4.0 Admin App Mern( Node.js / React / Redux / Ant Design ) Crud & Auth , Dashboard

Starter Antd 4.0 Admin App  Mern( Node.js / React / Redux / Ant Design ) Crud & Auth , Dashboard

Starter Antd Admin (Crud & auth) Mern App (Express.js / React / Redux / MongoDB) App built for DigitalOcean MongoDB Hackathon CRM Starter Mern Antd Ad

Jan 8, 2023

Boilerplate for Truffle, Web3.js, React, Redux Toolkit

Truffle, React, Redux Toolkit, Web3.js boilerplate What it's for Currently, it's a nightmare and takes forever trying to get React working with Truffl

Jun 9, 2022

This command line helps you create components, pages and even redux implementation for your react project

This command line helps you create components, pages and even redux implementation for your react project

react-help-create This command line helps you create components, pages and even redux implementation for your react project. How to install it? To ins

Dec 10, 2022

Redux-Toolkit example with React Hooks CRUD Application, Axios, Rest API, Bootstrap

Redux-Toolkit example with React Hooks CRUD Application, Axios, Rest API, Bootstrap

Redux-Toolkit CRUD example with React Hooks, Axios & Web API Build Redux-Toolkit CRUD application with React Hooks and Rest API calls in that: Each it

Dec 27, 2022

This app simulates a simple bookstore, and it was created using ReactJS and Redux.

Bookstore About The Bookstore is a website similar to the "Awesome Books" website built in the previous Microverse module (see live version). My goal

Oct 3, 2021
Owner
Melvin Ng
Software development changed my life. Now, I want to use software development to change the lives of others ๐Ÿ˜Š.
Melvin Ng
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.

Recoil ยท Recoil is an experimental set of utilities for state management with React. Please see the website: https://recoiljs.org Installation The Rec

Facebook Experimental 18.2k Jan 8, 2023
A state management library for React, heavily inspired by vuex

Vuex - But for React! โš› If you know vuex, you know it's as close as we get to a perfect state management library. What if we could do this in the reac

Dana Janoskova 103 Sep 8, 2022
Tiny and powerful state management library.

BitAboutState Tiny and powerful React state management library. 100% Idiomatic React. Install npm install --save @bit-about/state Features 100% Idioma

null 53 Nov 5, 2022
Redux-todos - simple react, redux todos

Redux Todos Please star this repo if you like โญ It's motivates me a lot! Getting Started This project was bootstrapped with Create React App. Stack Av

Ruslan Shvetsov 2 Jul 29, 2022
Create a performant distributed context state by synergyzing atomar context pieces and composing reusable state logic.

Synergies Create a performant distributed context state by synergyzing atomar context pieces and composing reusable state logic. synergies is a tiny (

Lukas Bach 8 Nov 8, 2022
๐Ÿป Bear necessities for state management in React

A small, fast and scaleable bearbones state-management solution. Has a comfy api based on hooks, isn't boilerplatey or opinionated, but still just eno

Poimandres 25.5k Jan 9, 2023
๐Ÿ High performance subscription-based form state management for React

You build great forms, but do you know HOW users use your forms? Find out with Form Nerd! Professional analytics from the creator of React Final Form.

Final Form 7.2k Jan 7, 2023
Twitter-Clone-Nextjs - Twitter Clone Built With React JS, Next JS, Recoil for State Management and Firebase as Backend

Twitter Clone This is a Next.js project bootstrapped with create-next-app. Getting Started First, run the development server: npm run dev # or yarn de

Basudev 0 Feb 7, 2022
๐Ÿ”ฎ tiny robust state management

?? snapstate tiny robust state management ?? npm install @chasemoskal/snapstate ??๏ธ watch for changes to properties ??๏ธ track only the properties you

Chase Moskal 5 Dec 23, 2022
A tiny package for JavaScript Web App's state management based on RxJS & Immer

A tiny package for JavaScript Web App's state management based on RxJS & Immer

Xiao Junjiang 12 Oct 19, 2022