Skip to content

Instantly share code, notes, and snippets.

@charly-palencia
Created June 14, 2019 04:17
Show Gist options
  • Select an option

  • Save charly-palencia/bcda65d3d9ed641ee2b5c5078f9b3ae6 to your computer and use it in GitHub Desktop.

Select an option

Save charly-palencia/bcda65d3d9ed641ee2b5c5078f9b3ae6 to your computer and use it in GitHub Desktop.
import React from "react";
import { connect } from "react-redux";
...
import {fetchColor} from "./actions";
...
function App({fetchColor, color}) {
return (
<AppContainer>
...
<Router>
<Header color={color} onClick={fetchColor}>
...
</Header>
</Router>
</AppContainer>
);
}
function mapStateToProps(state) {
return {
color: state.color.color,
};
}
const mapDispatchToProps = {
fetchColor,
};
export default connect(mapStateToProps, mapDispatchToProps)(App);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment