Skip to content

Instantly share code, notes, and snippets.

@velotiotech
Created June 16, 2020 10:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save velotiotech/b2d3722cc183e59b9a632c8292a2fa86 to your computer and use it in GitHub Desktop.
Save velotiotech/b2d3722cc183e59b9a632c8292a2fa86 to your computer and use it in GitHub Desktop.
import React, { Component } from 'react';
import './App.css';
import { connect } from 'react-redux';
import { getPostByIdFunc, getPostsBulkFunc } from './actions';
class App extends Component {
render() {
console.log(this.props);
return (
<div className="App">
<button onClick={() => {
this.props.getPostById(1);
}}>By Id</button>
<button onClick={() => {
this.props.getPostBulk();
}}>In bulk</button>
</div>
);
}
}
const mapStateToProps = state => {
return {
state
};
}
const mapDispatchToProps = dispatch => {
return {
getPostById: getPostByIdFunc(dispatch),
getPostBulk: getPostsBulkFunc(dispatch)
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment