componentWillReceiveProps(nextProps) {
if (
**this.state.clicked** &&
this.props.something &&
nextProps.addSubtract
) {
this.setState({ valid: nextProps.isValid });
}
if (!this.props.someItems) {
this.setState({ products: nextProps.propsValues});
}
if (nextProps.valueOfProps && **this.methodOnClass**) {
..........
..........
}
}
The code above is similar to a new project I'm working on and I have encountered a road-block. Since componentWillReceiveProps is deprecated and I need to replace a lot of code inside it with this.method and this.state , is there a way to access these in getDerivedStateFromProps without moving a lot of logic in other lifecycle methods.