0% found this document useful (0 votes)
2 views

Tasks_Redux_Toolkit

Uploaded by

aracasablanca7
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

Tasks_Redux_Toolkit

Uploaded by

aracasablanca7
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Add , Delete Items in Redux Toolkit

La structure des fichiers :


tasksSlice.js
import { createSlice } from "@reduxjs/toolkit";

const todoSlice=createSlice( {
name:"todo",
initialState:[
{id:1,text:"play foot",done:false},
{id:2,text:"do your homework",done:true}
],
reducers: {

addTask:(state,action)=>{
//add code here .....

},
toggleTask:(state,action)=>{
//add code here .....
},
deleteTask:(state,action)=>{
//add code here .....
}
}
})
export const {addTask,deleteTask,toggleTask}=todoSlice.actions
export default todoSlice.reducer

You might also like