import*as todoTypes from'./todoType';constreducer=(State =[], todo)=>{const{ type, data }= todo;switch(type){case todoTypes.ADDList:const result =[
data,...State
]
console.log(result)return result
case todoTypes.DELLIST:
State.splice(data,1)return[...State]default:return State
}}exportdefault reducer
todolist/redux/todolist.js
import*as todoType from'./todoType.js';exportconstaddList=(data)=>({ type: todoType.ADDList, data })exportconstdelList=(data)=>({ type: todoType.DELLIST, data })