title: React JS pass object to an action
body: <p>I have a form with validation on it and after it is creates the object "fields". How can I now pass this object to the action "createPost"? I'm guessing I need to do something with "props"? Or I'm guessing it might be something to do with the dispatcher line?</p>
  
  <pre><code>import React, { Component } from 'react';
  import Header from '../components/header';
  import Formous from 'formous';
  import { createPost } from '../actions/index';
  
  class ErrorText extends Component {
    render() {
      return &lt;div style={{ color: '#f00' }}&gt;
        {this.props.errorText}
      &lt;/div&gt;
    }
  }
  
  class MyComponent extends Component {
    componentWillReceiveProps(nextProps) {
      // Set default form values (might be appropriate in a different method
      this.props.setDefaultValues({
        age: 33,
        name: 'Sir Andrew',
      });
    }
  
    handleSubmit(formStatus, fields) {
      if (!formStatus.touched) {
        alert('Please fill out the form.');
        return;
      }
  
      if (!formStatus.valid) {
        alert('Please address the errors in the form.');
        return;
      }
  
      // All good! Do something with fields.name.value and fields.age.value
      console.log(formStatus, fields);
    }
  
    render() {
      const {
        fields: { age, name },
        formSubmit,
      } = this.props;
  
      return &lt;div&gt;
      &lt;Header /&gt;
        &lt;form onSubmit={formSubmit(this.handleSubmit)}&gt;
          &lt;div&gt;
            &lt;input
              placeholder="Name"
              type="text"
              value={name.value}
              { ...name.events }
            /&gt;
            &lt;ErrorText { ...name.failProps } /&gt;
          &lt;/div&gt;
          &lt;div&gt;
            &lt;input
              placeholder="Age"
              type="text"
              value={age.value}
              { ...age.events }
            /&gt;
            &lt;ErrorText { ...age.failProps } /&gt;
          &lt;/div&gt;
          &lt;div&gt;
            &lt;button type="submit"&gt;Submit&lt;/button&gt;
          &lt;/div&gt;
        &lt;/form&gt;
      &lt;/div&gt;
    }
  }
  
  const formousOptions = {
    fields: {
      name: {
        tests: [
          {
            critical: true,
            failProps: {
              errorText: 'Name is required.',
            },
            test(value) {
              return value !== '';
            },
          }
        ],
      },
  
      age: {
        tests: [
          {
            critical: true,
            failProps: {
              errorText: 'Age should be a number.',
            },
            test(value) {
              return /^\d*$/.test(value);
            },
          },
          {
            critical: false,
            failProps: {
              errorText: 'Are you sure you\'re that old? :o',
            },
            test(value) {
              return +value &lt; 120;
            },
          },
        ],
      },
    },
  };
  
  export default Formous(formousOptions)(MyComponent)
  </code></pre>