Skip to content

Instantly share code, notes, and snippets.

@baso53
Last active January 21, 2020 14:35
Show Gist options
  • Select an option

  • Save baso53/7c7e6f918df603988df4ce31e5baecd5 to your computer and use it in GitHub Desktop.

Select an option

Save baso53/7c7e6f918df603988df4ce31e5baecd5 to your computer and use it in GitHub Desktop.
implementing-sagas-App-1
import React from 'react';
import { connect } from 'react-redux';
import { fetchDataRequest } from './actions';
import "./App.css";
const App = props => (
<React.Fragment>
<div className='button' onClick={() => props.fetchDataRequest('male')} >
Fetch a random male name!
</div>
<div className='button' onClick={() => props.fetchDataRequest('female')} >
Fetch a random male name!
</div>
<div>
Hey, I'm {props.personState.name} {props.personState.surname} from {props.personState.region}
</div>
</React.Fragment>
);
const mapStateToProps = ({ personState }) => ({ personState });
export default connect(mapStateToProps, { fetchDataRequest })(App);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment