Home > Mobile >  Redux Toolkit React Native - setState problem
Redux Toolkit React Native - setState problem

Time:11-28

Hello i have problem with set setName in react native redux toolkit enter image description here

enter image description hereenter image description hereenter image description here i dont know whats going wrong. Even i did example aciton form redux-toolkit, still not working

i want setState in redux toolkit

CodePudding user response:

First problem,reducer take one more arg which name is action

setName:(state,action) => { state.name = action.payload }

Also, the cause of the error must be elsewhere. Because the error indicates that you cannot access the object. I think you first import reducer import informations from '.....' and then access with informations.setName().But then it should be giving an error because you changed it to as import { setName } from '.....'

CodePudding user response:

i write 'reducer' instead "reducers"

  • Related