Redux Toolkit - Reseting state?

Answer

You need to write a reducer for that by hand - you can still use RTK everywhere else.

const reducer = combineReducers({
user,
post,
})

const resetAction = createAction('reset')

const resettableReducer = (state, action) => {
if (resetAction.match(action) {
return reducer(undefined, action)
}
return reducer(state, action)
}

All react js Questions

Ask your interview questions on react-js

Write Your comment or Questions if you want the answers on react-js from react-js Experts
Name* :
Email Id* :
Mob no* :
Question
Or
Comment* :
 





Disclimer: PCDS.CO.IN not responsible for any content, information, data or any feature of website. If you are using this website then its your own responsibility to understand the content of the website

--------- Tutorials ---