UNPKG

@quoine/core

Version:

27 lines (22 loc) 539 B
import PropTypes from 'prop-types'; import React from 'react'; import View from './View'; class RadioInput extends React.PureComponent { constructor(props) { super(props); this.onChange = this.onChange.bind(this); } onChange(event) { this.props.onChange(event.target.value); } render() { return ( // onChange in this.props will be replaced <View {...this.props} onChange={this.onChange} /> ); } } RadioInput.propTypes = { onChange: PropTypes.func.isRequired, }; export default RadioInput;