# useStoreDispatch

A hook (opens new window) granting your components access to the store's dispatch.

const dispatch = useStoreDispatch();

# Example

import { useState } from 'react';
import { useStoreDispatch } from 'easy-peasy';

const AddTodo = () => {
  const [text, setText] = useState('');
  const dispatch = useStoreDispatch();
  return (
    <div>
      <input value={text} onChange={(e) => setText(e.target.value)} />
      <button onClick={() => dispatch({ type: 'ADD_TODO', payload: text })}>Add</button>
    </div>
  );
};