Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- export const postsSlice = createSlice({
- name: 'post',
- initialState: {
- lastID: 0,
- posts: []
- },
- reducers: {
- createPost: (state, action) => {
- state.posts.push({
- id: ++state.lastID,
- author: action.payload.author,
- text: action.payload.text
- });
- }
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement