node-react-ecommerce icon indicating copy to clipboard operation
node-react-ecommerce copied to clipboard

TypeError: Cannot destructure property 'loading' of 'userUpdate' as it is undefined.

Open jeffandeko opened this issue 5 years ago • 2 comments

21 | dispatch(update({ userId: userInfo._id, email, name, password })) 22 | } 23 | const userUpdate = useSelector(state => state.userUpdate);

24 | const { loading, success, error } = userUpdate; | ^ 25 | 26 | const myOrderList = useSelector(state => state.myOrderList); 27 | const { loading: loadingOrders, orders, error: errorOrders } = myOrderList;

jeffandeko avatar Jun 01 '20 03:06 jeffandeko

It means that state.userUpdate is undefined. Check the reducer to see if you initialize it or not.

basir avatar Jun 03 '20 07:06 basir

Had the same problem, but with userRegister. With userRegisterReducer.js was all okey, but needed to import and add it to combineReducers({...}) in store.js. Now all works.

Benerous avatar Jun 26 '20 14:06 Benerous