import React from 'react';

import {FormsyDate, FormsyText} from 'formsy-material-ui';
import {Form} from 'formsy-react';
import RaisedButton from 'material-ui/lib/raised-button';

import {createBook} from '../actions/crudActions';

export default class BookComponent extends React.Component {
    constructor(props) {
        super(props);
        this.state = {
          canSubmit: false
        };
    }

    submit(_data) {
      this.props.onAddBook(_data);
    }

    render() {
      return (
        <Form onValidSubmit={(data) => {this.submit(data)}}
            onValid={() => {this.setState({canSubmit: true})}}
            onInvalid={() => {this.setState({canSubmit: false})}}
        >
          <FormsyText
            name='book-title'
            required
            floatingLabelText='Title'
          />
          <FormsyText
            name='book-author-name'
            required
            floatingLabelText='Author'
          />
          <div>
            <FormsyText
              name='book-nb-pages-read'
              value='0'
              validations='isInt'
            />
            <span>of</span>
            <FormsyText
              name='book-nb-pages'
              required
              validations='isInt'
            />
          </div>
          <RaisedButton
            type="submit"
            label="Submit"
            disabled={!this.state.canSubmit}
          />
        </Form>
      );
    }
}

import React from 'react';

import {FormsyDate, FormsyText} from 'formsy-material-ui';
import {Form} from 'formsy-react';
import RaisedButton from 'material-ui/lib/raised-button';

import {createBook} from '../actions/crudActions';

export default class BookComponent extends React.Component {
    constructor(props) {
        super(props);
        this.state = {
          canSubmit: false
        };
    }

    submit(_data) {
      this.props.onAddBook(_data);
    }

    render() {
      return (
        <Form onValidSubmit={(data) => {this.submit(data)}}
            onValid={() => {this.setState({canSubmit: true})}}
            onInvalid={() => {this.setState({canSubmit: false})}}
        >
          <FormsyText
            name='book_title'
            required
            floatingLabelText='Title'
          />
          <FormsyText
            name='book_author_name'
            required
            floatingLabelText='Author'
          />
          <div>
            <FormsyText
              name='book_nb_pages_read'
              value='0'
              validations='isInt'
            />
            <span>of</span>
            <FormsyText
              name='book_nb_pages'
              required
              validations='isInt'
            />
          </div>
          <RaisedButton
            type='submit'
            label='Submit'
            disabled={!this.state.canSubmit}
          />
        </Form>
      );
    }
}

use single quotes only