Created
September 20, 2024 08:38
-
-
Save zehan12/fde808f1a7ae2ed8d6ea09f72ffa70f9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { useSelector, useDispatch } from "react-redux"; | |
| function MyReduxComponent() { | |
| const count = useSelector((state) => state.counter); | |
| const dispatch = useDispatch(); | |
| return ( | |
| <div> | |
| <p>Count: {count}</p> | |
| <button onClick={() => dispatch({ type: "INCREMENT" })}>Increment</button> | |
| </div> | |
| ); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment