Specify default props
This commit is contained in:
parent
808344eecf
commit
fce2434dcd
4 changed files with 8 additions and 19 deletions
|
@ -25,10 +25,6 @@ class BlacklistForm extends React.Component {
|
|||
}
|
||||
|
||||
bindValue(e) {
|
||||
if (!this.props.onChange) {
|
||||
return;
|
||||
}
|
||||
|
||||
let name = e.target.name;
|
||||
let index = e.target.getAttribute('data-index');
|
||||
let next = this.props.value ? this.props.value.slice() : [];
|
||||
|
@ -52,6 +48,7 @@ BlacklistForm.propTypes = {
|
|||
|
||||
BlacklistForm.defaultProps = {
|
||||
value: [],
|
||||
onChange: () => {},
|
||||
};
|
||||
|
||||
export default BlacklistForm;
|
||||
|
|
|
@ -30,10 +30,6 @@ class KeymapsForm extends React.Component {
|
|||
}
|
||||
|
||||
bindValue(e) {
|
||||
if (!this.props.onChange) {
|
||||
return;
|
||||
}
|
||||
|
||||
let next = { ...this.props.value };
|
||||
next[e.target.name] = e.target.value;
|
||||
|
||||
|
@ -48,6 +44,7 @@ KeymapsForm.propTypes = {
|
|||
|
||||
KeymapsForm.defaultProps = {
|
||||
value: {},
|
||||
onChange: () => {},
|
||||
};
|
||||
|
||||
export default KeymapsForm;
|
||||
|
|
|
@ -7,9 +7,6 @@ class PropertiesForm extends React.Component {
|
|||
render() {
|
||||
let types = this.props.types;
|
||||
let value = this.props.value;
|
||||
if (!value) {
|
||||
value = {};
|
||||
}
|
||||
|
||||
return <div className='form-properties-form'>
|
||||
{
|
||||
|
@ -40,10 +37,6 @@ class PropertiesForm extends React.Component {
|
|||
}
|
||||
|
||||
bindValue(e) {
|
||||
if (!this.props.onChange) {
|
||||
return;
|
||||
}
|
||||
|
||||
let name = e.target.name;
|
||||
let next = { ...this.props.value };
|
||||
if (e.target.type.toLowerCase() === 'checkbox') {
|
||||
|
@ -63,4 +56,9 @@ PropertiesForm.propTypes = {
|
|||
onChange: PropTypes.func,
|
||||
};
|
||||
|
||||
PropertiesForm.defaultProps = {
|
||||
value: {},
|
||||
onChange: () => {},
|
||||
};
|
||||
|
||||
export default PropertiesForm;
|
||||
|
|
|
@ -44,10 +44,6 @@ class SearchForm extends React.Component {
|
|||
}
|
||||
|
||||
bindValue(e) {
|
||||
if (!this.props.onChange) {
|
||||
return;
|
||||
}
|
||||
|
||||
let value = this.props.value;
|
||||
let name = e.target.name;
|
||||
let index = e.target.getAttribute('data-index');
|
||||
|
@ -83,6 +79,7 @@ SearchForm.propTypes = {
|
|||
|
||||
SearchForm.defaultProps = {
|
||||
value: { default: '', engines: []},
|
||||
onChange: () => {},
|
||||
};
|
||||
|
||||
export default SearchForm;
|
||||
|
|
Reference in a new issue