react-redux-clean-connect
A React Redux helper for less React connect boilerplate
Installation
$ npm install --save react-redux-clean-connect
Usage
// Connecting can look like this: ▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼ const mapStateAndDispatchToProps = { const partialState = propsFromStatepartialState return // state props errorMessage: partialStateerrormessage username: partialStatesearchCriteriausername usersObj: partialStateusersObj // dispatch props updateSearchCriteria } mapStateAndDispatchToProps Component // Instead of looking like this: ▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼ const mapStateToProps = { return ...ownProps errorMessage: partialStateerrormessage username: partialStatesearchCriteriausername usersObj: partialStateusersObj } const mapDispatchToProps = getByUUID updateSearchCriteria const mergeProps = { const partialState = propsFromStatepartialState return ...ownProps ...propsFromState ...propsFromDispatch propsFromDispatch } mapStateToProps mapDispatchToProps mergeProps Component<any any>
License
MIT © PC Thomatos