Horje
createslice redux toolkit Code Example
createslice redux toolkit
const postsSlice = createSlice({
  name: 'posts',
  initialState: [],
  reducers: {
    createPost(state, action) {},
    updatePost(state, action) {},
    deletePost(state, action) {},
  },
})

console.log(postsSlice)
/*
{
    name: 'posts',
    actions : {
        createPost,
        updatePost,
        deletePost,
    },
    reducer
}
*/

const { createPost } = postsSlice.actions

console.log(createPost({ id: 123, title: 'Hello World' }))
// {type : "posts/createPost", payload : {id : 123, title : "Hello World"}}




Javascript

Related
angular mat select open programmatically Code Example angular mat select open programmatically Code Example
express static auth Code Example express static auth Code Example
how to return 5 records instead of 10 records in datatable Code Example how to return 5 records instead of 10 records in datatable Code Example
cleartimeout react Code Example cleartimeout react Code Example
createslice redux Code Example createslice redux Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
8