[react-json-tree] Mark deprecated React lifecycle methods as unsafe (#483)

This commit is contained in:
Joe Huang 2020-05-04 08:19:01 -07:00 committed by GitHub
parent 5ef08d04f1
commit fa90ae0a59
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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));
} }