Connect Decorators for React-Redux
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
src
.gitignore
README.md
package.json
yarn.lock

README.md

A Collection of decorators to make using connect easier.

Installation

npm install react-redux-decorate

Example

import React from 'react'
import { mapDispatchToProps, mapStateToProps } from 'react-redux-decorate'

@mapStateToProps((state) => ({
  users: state.users
}))
@mapDispatchToProps((dispatch, ownProps) => ({
  getUser(id) {
    dispatch(ownProps.getUser(id))
  }
}))
export default class MyFancyComponent extends React.Component {
 // react things in here
}

Usage

mapStateToProps(mapStateToProps (Function), [options] (Object))

mapDispatchToProps(mapDispatchToProps(Function), [options] (Object))

fn and options follow the react-redux-api for connect

react-redux's connect is also in case of complicated use-cases