Horje
createslice redux Code Example
createslice redux
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
file_get_contents in javascript Code Example file_get_contents in javascript Code Example
js vanilla when i remove one object it removes all of them Code Example js vanilla when i remove one object it removes all of them Code Example
react lottie player on hover Code Example react lottie player on hover Code Example
DC League of Super-Pets Code Example DC League of Super-Pets Code Example
adonis count with where Code Example adonis count with where Code Example

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