Skip to content

Instantly share code, notes, and snippets.

/* render part of building component */ 
render() { 
  return ( 
    <div> 
      <label htmlForm={this.props.name}>
        {label}
      </label> 
      
 {/* general props */} 
import React from 'react'; 
import { reduxForm } from 'redux-form'; 
const ExampleForm = ({ invalid, submitting, reset }) => { 
  const handleSubmit = (values) => { 
    console.log(values); // ...code to submit values 
   }; 
  return ( 
    <form onSubmit={handleSubmit}> 
 
// React component
import React, { Component } from 'react'; 
import { Form } from 'formsy-react'; 
class ExampleForm extends Component { 
  constructor() { 
    this.state = { canSubmit: false, }; 
    this.enableSubmit = this.enableSubmit.bind(this); 
    this.disableSubmit = this.disableSubmit.bind(this); 
    this.submitValues = this.submitValues.bind(this); 
// in your root reducer 
import { combineReducers } from 'redux'; 
import { reducer } from 'redux-form'; 
export default combineReducers({ 
form: reducer, // form Reducer which has all details about form. 
// ...other reducers });
```
// in your root reducer import { combineReducers } from 'redux';
import { reducer } from 'redux-form';
export default combineReducers({
form: reducer, // form Reducer which has all details about form.
// ...other reducers });
```