Redux is a JS library for predictable and maintainable global state management.

It helps you write applications that behave consistently, run in different environments (client, server, and native), and are easy to test. On top of that, it provides a great developer experience, such as live code editing combined with a time traveling debugger.

It consists of

store

action

reducers

Store→

its a place where we put all our global state

for example:- a sign in

A store is something like a databse of our state we can take a slice from our store and put it inside any screen or any component.

Actions→

Actions are plain javascript objects.

Actions has two main properties

property1: Type (type is referred to the action i.e., if i want to make a login action the type is going to be “Login” if i want to add too the type is going to be “ADD_TODO”)

property2: Payload(payload is the data

i.e., if i want to create a login action i need a data like email and password and we take that data and pass it to our reducers

now a question arises here is what are reducers?

Reducers→

Reducers are javascript functions, those functions take the data from actions they take the type and payload and update the state depends on those things.