define a reducer in redux toolkit 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)
})