Replies: 1 comment 1 reply
-
If you have a question, please put in the effort to actually ask the question. That's not even a full sentence and nobody here can read your mind. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
here the createSlice
export const todoSlice = createSlice({
name: "todos",
initialState: [],
reducers: {
addTodo: (state, action) => {
// action.payload accept multiple arguments or object
return [...state, action.payload];
},
},
});
export const { addTodo } = todoSlice.actions;
export default todoSlice.reducer;
// here
const [textName, setTextName] = useState("");
const [text, setText] = useState("");
const dispatch = useDispatch();
const addTodoHandler = (e) => {
e.preventDefault();
};
Beta Was this translation helpful? Give feedback.
All reactions