Skip to content

Instantly share code, notes, and snippets.

@JaysonChiang
Last active March 1, 2021 10:59
Show Gist options
  • Save JaysonChiang/df838b1fd5fcc352e10c3263d1137b32 to your computer and use it in GitHub Desktop.
Save JaysonChiang/df838b1fd5fcc352e10c3263d1137b32 to your computer and use it in GitHub Desktop.
import { useDispatch } from "react-redux";
import actionCreators from "./action-creators";
const AddButton = () => {
const dispatch = useDispatch();
const onClick = () => {
dispatch(actionCreators.addCount());
};
return <button onClick={onClick}>+1</button>;
};
export default AddButton;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment