createSlice redux how to make a function to make reducers code example
Example: 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)
})