useAppDispatch()
function useAppDispatch(): AppDispatch;
React hook to get the typed dispatch function. Provides type-safe dispatching of Redux actions.
Returns
Typed Redux dispatch function
Example
function MyComponent() {
const dispatch = useAppDispatch();
const handleClick = () => {
dispatch(myAction());
};
return <button onClick={handleClick}>Click me</button>;
}