`propTypes` was seperated/depreciated from React as of 15.5.0: https://facebook.github.io/react/blog/2017/04/07/react-v15.5.0.html#migrating-from-react.proptypes
19 lines
456 B
JavaScript
19 lines
456 B
JavaScript
import PropTypes from 'prop-types';
|
|
import React from 'react';
|
|
|
|
export default class StringControl extends React.Component {
|
|
handleChange = (e) => {
|
|
this.props.onChange(e.target.value);
|
|
};
|
|
|
|
render() {
|
|
return <input type="text" id={this.props.forID} value={this.props.value || ''} onChange={this.handleChange} />;
|
|
}
|
|
}
|
|
|
|
StringControl.propTypes = {
|
|
onChange: PropTypes.func.isRequired,
|
|
forID: PropTypes.string,
|
|
value: PropTypes.node,
|
|
};
|