Created
June 16, 2020 10:04
-
-
Save velotiotech/b2d3722cc183e59b9a632c8292a2fa86 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 './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