Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import { useCallback } from 'react';
- import { useDispatch } from 'react-redux';
- import { addTodo } from '../reducers/todo.reducer';
- export default function useAddTodo() {
- const dispatch = useDispatch();
- const onAdd = useCallback((payload) => dispatch(addTodo(payload)), [dispatch]);
- return onAdd;
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement