Created
June 20, 2019 10:38
-
-
Save indreklasn/5a2661a98e3501be5081d53bd2475df0 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 React from "react"; | |
import { useSelector, useDispatch } from "react-redux"; | |
import { TOGGLE } from "./UiReducer"; | |
const Toggle = () => { | |
const ui = useSelector(state => state.ui); | |
const dispatch = useDispatch(); | |
return ( | |
<div> | |
<div>{JSON.stringify(ui)}</div> | |
<input | |
type="checkbox" | |
value={ui.toggle} | |
onChange={() => dispatch({ type: TOGGLE })} | |
/> | |
</div> | |
); | |
}; | |
export default Toggle; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment