https://github.com/mrsteele/react-redux-hoc
A React-Redux HOC (Higher Order Component)
https://github.com/mrsteele/react-redux-hoc
hoc react redux
Last synced: 3 months ago
JSON representation
A React-Redux HOC (Higher Order Component)
- Host: GitHub
- URL: https://github.com/mrsteele/react-redux-hoc
- Owner: mrsteele
- License: mit
- Created: 2018-04-09T01:46:17.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2018-04-09T02:20:28.000Z (about 7 years ago)
- Last Synced: 2024-12-28T08:41:00.194Z (5 months ago)
- Topics: hoc, react, redux
- Language: JavaScript
- Size: 28.3 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# react-redux-hoc
> WIP!!!
A basic HOC to plug react into your application
### About
This plugin was made to create a basic react-redux container with save-able features.
Lets say you have an `Email` component like so:
```js
// Email.js
import React from 'react'
import { SubjectLine, MessageBody, Button } from 'components'
import { submitEmail, saveEmail } from 'services'class Email extends React.Component {
onChange = (e) => this.setState({ [e.target.name]: e.target.value})
onSubmit = (e) => {
e.preventDefault()const { subject, body } = this.state
submitEmail(subject, body).then(result => {
console.log(result)
// { subject: 'here', body: 'here' }this.setState(result)
}).catch(err => {
console.log('some error occurred', err)
})
}
render () {
const { subject, body } = this.state
return (
Save Draft
Submit
)
}
}
```