Skip to content

Instantly share code, notes, and snippets.

@rubenmarcus
Last active March 25, 2020 21:11
Show Gist options
  • Save rubenmarcus/fae97b192b20619aebc879f0e81f5824 to your computer and use it in GitHub Desktop.
Save rubenmarcus/fae97b192b20619aebc879f0e81f5824 to your computer and use it in GitHub Desktop.
import React from "react";
import { connect } from "react-redux";
import { toggleSwitch } from "./UiReducer";
const Toggle = ({ ui, toggleSwitch }) => (
<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