Created
March 2, 2017 22:05
-
-
Save ericdfields/819c2c90484858e4e459cf650c28ff1b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
EditPersonForm = reduxForm({ | |
form: 'person', | |
touchOnChange: true | |
})(EditPersonForm); | |
import { createStore, combineReducers } from 'redux' | |
import { reducer as formReducer } from 'redux-form' | |
const reducers = { | |
form: formReducer | |
} | |
const reducer = combineReducers(reducers) | |
const store = createStore(reducer) | |
import { Provider } from 'react-redux' | |
class EditPersonComponent extends Component { | |
static defaultProps = { | |
handleUpdate: PropTypes.func.isRequired | |
} | |
handleSubmit = (values) => { | |
const person = prepareModelForRails(values) | |
console.log(person) | |
// this.props.handleUpdate(person) | |
} | |
render() { | |
const { person } = this.props | |
return( | |
<Provider store={store}> | |
<EditPersonForm | |
onSubmit={this.handleSubmit} | |
initialValues={person} /> | |
</Provider> | |
) | |
} | |
} | |
export default EditPrescriberComponent; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment