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