|
@@ -19,16 +19,17 @@ const profileReducer = (state = initialState, action) => {
|
|
|
message: state.newPostText,
|
|
|
likesCount: 0,
|
|
|
};
|
|
|
- let stateCopy = {...state};
|
|
|
- stateCopy.post = [...state.post];
|
|
|
- stateCopy.post.push(newPost);
|
|
|
- stateCopy.newPostText = '';
|
|
|
- return stateCopy;
|
|
|
+ return {
|
|
|
+ ...state,
|
|
|
+ post: [...state.post, newPost],
|
|
|
+ newPostText: ''
|
|
|
+ };
|
|
|
}
|
|
|
case UPDATE_NEW_POST_TEXT: {
|
|
|
- let stateCopy = {...state};
|
|
|
- stateCopy.newPostText = action.newText;
|
|
|
- return stateCopy;
|
|
|
+ return {
|
|
|
+ ...state,
|
|
|
+ newPostText: action.newText
|
|
|
+ };
|
|
|
}
|
|
|
default:
|
|
|
return state;
|