apeman-react-checkbox

"use strict";
 
const React = require('react'),
    ApCheckbox = require('../../lib/ap_checkbox');
 
module.exports = React.createClass({
    getInitialState: function () {
        return {
            checked: 'foo02'
        };
    },
    handleChange: function (e) {
        let s = this;
        s.setState({
            checked: e.target.value
        });
    },
    render: function () {
        let s = this,
            state = s.state;
        return (
            <div>
                <ApCheckbox onChange={s.handleChange}
                            name="foo"
                            id="foo-02"
                            checked={state.checked === 'foo01'}
                            title="This is foo 01"
                            value={"foo01"}></ApCheckbox>
                <ApCheckbox onChange={s.handleChange}
                            name="foo"
                            id="foo-01"
                            checked={state.checked === 'foo02'}
                            title="This is foo 02"
                            value={"foo02"}></ApCheckbox>
            </div>
        );
    }
});