-
-
Save iamhaiderkhan/1d34623c82905a504ce17db85677bbeb to your computer and use it in GitHub Desktop.
This file contains 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"; | |
import React from "react"; | |
import * as actions from "./actions"; | |
const ReduxHooksExample = () => { | |
const dispatch = useDispatch(); | |
const counter = useSelector((state) => state.counter); | |
return ( | |
<div> | |
<span>{counter.value}</span> | |
<button onClick={() => dispatch(actions.incrementCounter)}> | |
Counter +1 | |
</button> | |
</div> | |
); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment