redux toolkit or redux code example
Example 1: install redux toolkit
npm install @reduxjs/toolkit react-redux
Example 2: redux toolkit reducer
import {createAction, createReducer} from '@reduxjs/toolkit ;
//Action
const add = createAction('add');
//Reducer
const Reducer = createReducer(initialState= 0, (builder)=>{
builder.addCase(add, (state,action) => state + 1)
})