https://github.com/evturn/redux-connect-decorator
React Redux's connect as a decorator.
https://github.com/evturn/redux-connect-decorator
decorators react react-redux redux
Last synced: 5 months ago
JSON representation
React Redux's connect as a decorator.
- Host: GitHub
- URL: https://github.com/evturn/redux-connect-decorator
- Owner: evturn
- Created: 2017-03-11T16:16:34.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2018-07-29T11:42:04.000Z (almost 8 years ago)
- Last Synced: 2025-09-27T01:52:59.472Z (9 months ago)
- Topics: decorators, react, react-redux, redux
- Language: JavaScript
- Size: 23.4 KB
- Stars: 43
- Watchers: 1
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
______ __
/ ____ \_________ ____ ____ ___ _____/ /_
/ / __ `/ ___/ __ \/ __ \/ __ \/ _ \/ ___/ __/
/ / /_/ / /__/ /_/ / / / / / / / __/ /__/ /_
\ \__,_/\___/\____/_/ /_/_/ /_/\___/\___/\__/
\____/
#### Usage
```js
import React, { Component } from 'react'
import connect from 'redux-connect-decorator'
import Footer from './components/Footer'
import Header from './components/Header'
import Messages from './components/Messages'
import { fetchInitialData, showSpinner } from './actions'
@connect(state => ({
messages: state.messages,
fetching: state.fetching,
}), {
fetchInitialData,
showSpinner,
})
class App extends Component {
componentDidMount() {
this.props.fetchInitialData()
}
componentWillReceiveProps(nextProps) {
if (nextProps.fetching) {
this.props.showSpinner()
}
}
render() {
return (
)
}
}
export default App
```
#### .babelrc
Listed in this order.
```json
{
"plugins": [
"babel-plugin-transform-decorators-legacy",
"babel-plugin-transform-decorators"
]
}
```
###### yarn
```
yarn add redux-connect-decorator
```
###### npm
```
npm install --save redux-connect-decorator
```