Advertisement
Guest User

Untitled

a guest
Oct 22nd, 2019
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.30 KB | None | 0 0
  1. import { useCallback } from 'react';
  2. import { useDispatch } from 'react-redux';
  3. import { addTodo } from '../reducers/todo.reducer';
  4.  
  5. export default function useAddTodo() {
  6. const dispatch = useDispatch();
  7. const onAdd = useCallback((payload) => dispatch(addTodo(payload)), [dispatch]);
  8. return onAdd;
  9. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement