Mark deprecated React lifecycle methods as unsafe

This will allow this package to be updated to React 17. For more information, see: https://reactjs.org/docs/react-component.html#unsafe_componentwillreceiveprops
This commit is contained in:
TheLordHighExecutioner 2019-08-29 11:10:26 -07:00
parent 03d1448dc3
commit 567fff5018
2 changed files with 2 additions and 2 deletions

View File

@ -109,7 +109,7 @@ export default class JSONNestedNode extends React.Component {
this.state = getStateFromProps(props); this.state = getStateFromProps(props);
} }
componentWillReceiveProps(nextProps) { UNSAFE_componentWillReceiveProps(nextProps) {
const nextState = getStateFromProps(nextProps); const nextState = getStateFromProps(nextProps);
if (getStateFromProps(this.props).expanded !== nextState.expanded) { if (getStateFromProps(this.props).expanded !== nextState.expanded) {
this.setState(nextState); this.setState(nextState);

View File

@ -110,7 +110,7 @@ export default class JSONTree extends React.Component {
this.state = getStateFromProps(props); this.state = getStateFromProps(props);
} }
componentWillReceiveProps(nextProps) { UNSAFE_componentWillReceiveProps(nextProps) {
if (['theme', 'invertTheme'].find(k => nextProps[k] !== this.props[k])) { if (['theme', 'invertTheme'].find(k => nextProps[k] !== this.props[k])) {
this.setState(getStateFromProps(nextProps)); this.setState(getStateFromProps(nextProps));
} }