Created
March 25, 2020 21:11
-
-
Save rubenmarcus/65dcc1d29b7588a0b531434d8cd1089c 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 { connect, useSelector } from "react-redux"; | |
import { toggleSwitch } from "./UiReducer"; | |
const Toggle = ({ toggleSwitch }) => { | |
const ui = useSelector(state => state.ui); | |
return ( | |
<div> | |
<div>{JSON.stringify(ui)}</div> | |
<input type="checkbox" value={ui.toggle} onChange={toggleSwitch} /> | |
</div> | |
); | |
}; | |
export default connect( | |
null, | |
{ toggleSwitch } | |
)(Toggle); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment