Created
February 26, 2022 04:05
-
-
Save bashidagha/4f3fc926bd212d642889dc621eaa9842 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 {useDispatch, useSelector} from 'react-redux' | |
const Header = ()=> { | |
const user = useSelector((state) => state.username); | |
const dispatch = useDispatch(); | |
return ( | |
<div>{user} | |
<button onClick={()=> dispatch({type: "updateUser"})}>Change User</button> | |
</div> | |
) | |
} | |
export default Header |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment