An open API service indexing awesome lists of open source software.

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)

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

)
}
}
```