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
| import React from 'react'; | |
| import { reduxForm } from 'redux-form'; | |
| import FormComponent from './form.component'; | |
| export const FormContainer = ({ handleSubmit }) => { | |
| const submitForm = (formValues) => { | |
| console.log('submitting Form: ', formValues); | |
| } |
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
| import React from 'react'; | |
| import { reduxForm } from 'redux-form'; | |
| import FormComponent from './form.component'; | |
| export const FormContainer = props => { | |
| console.log('props: ', props); | |
| return ( | |
| <FormComponent | |
| /> |
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
| import React from 'react'; | |
| import { reduxForm } from 'redux-form'; | |
| import FormComponent from './form.component'; | |
| export const FormContainer = props => { | |
| return ( | |
| <FormComponent /> | |
| ); | |
| } |
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
| import React, { Component } from 'react'; | |
| class FormContainer extends Component { | |
| render() { | |
| return ( | |
| <div> | |
| a what whAT | |
| </div> | |
| ); | |
| } |
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
| import { combineReducers } from 'redux'; | |
| import { reducer as formReducer } from 'redux-form'; | |
| export default function createReducer(extraReducerObjects = {}) { | |
| return combineReducers({ | |
| form: formReducer, | |
| ...extraReducerObjects | |
| }); | |
| } |
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
| import { createStore, applyMiddleware, compose } from 'redux'; | |
| import createReducer from './reducers'; | |
| const composeEnhancers = | |
| typeof window === 'object' && | |
| (window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ | |
| ? window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ | |
| : compose); | |
| export function configureStore() { |
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
| import React from 'react'; | |
| import ReactDOM from 'react-dom'; | |
| import { Provider } from 'react-redux'; | |
| import FormContainer from './modules/form/form.container'; | |
| import configureStore from './store'; | |
| const store = configureStore(); | |
| ReactDOM.render( |
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
| import React from 'react'; | |
| export const Text = props => { | |
| return ( | |
| <div className="mv4 w-100"> | |
| <div className="b sans-serif pv2 w-100"> | |
| {props.label} | |
| </div> | |
| <input |
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
| import { required } from './form.validators' | |
| … | |
| <Field | |
| name="firstName" | |
| label="First Named" | |
| component={Text} | |
| validate={required} | |
| /> | |
| ... |
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
| // validate : (value, allValues, props) => error [optional] # | |
| export const required = (value) => { | |
| if (!value) { | |
| return 'This field is required!' | |
| } | |
| }; |