import React, { PropTypes } from 'react'; import { connect } from 'react-redux'; import { Input, Switch, Button } from 'react-toolbox'; import { addFeatureToggle } from '../../store/actions'; class AddFeatureToggle extends React.Component { constructor () { super(); this.state = { name: '', description: '', enabled: false }; } static propTypes () { return { dispatch: PropTypes.func.isRequired, }; } static contextTypes = { router: React.PropTypes.object, } onSubmit = (evt) => { evt.preventDefault(); this.props.dispatch(addFeatureToggle(this.state.name)); this.context.router.push('/features'); }; handleChange = (key, value) => { const change = {}; change[key] = value; const newState = Object.assign({}, this.state, change); this.setState(newState); }; render () { return (


); } } export default connect()(AddFeatureToggle);