Uncaught TypeError: state.post is undefined ошибка в консоли

В React Redux Toolkit добавил

reducers: {
    addPost(state, action) {
      const { userimage, title, usertext } = action.payload;    
       state.post.push({
        id: 10,
        userimage,
        title,
        usertext                
       });              
    },
export const { addPost } = postSlice.actions;

На странице вызываю

dispatch(addPost({ userimage, title, usertext }));

При отправке формы получаю ошибку: state.post is undefined

Как исправить ошибку?


Ответы (0 шт):