it('should pass previous state to shouldComponentUpdate even with getDerivedStateFromProps', () => { const divRef = React.createRef(); class SimpleComponent extends React.Component { constructor(props) { super(props); this.state = { value: props.value, }; } static getDerivedStateFromProps(nextProps, prevState) { if (nextProps.value === prevState.value) { return null; } return {value: nextProps.value}; } shouldComponentUpdate(nextProps, nextState) { return nextState.value !== this.state.value; } render() { return value: {this.state.value}
; } } const div = document.createElement('div'); ReactDOM.render(, div); expect(divRef.current.textContent).toBe('value: initial'); ReactDOM.render(, div); expect(divRef.current.textContent).toBe('value: updated'); }); it('should call getSnapshotBeforeUpdate before mutations are committed', () => { const log = [];", "positive_passages": [{"docid": "doc-en-react-af6422597abfc3705e1e016cf37e5dbfbfdcf0923b24267ad3eb49d20f8d6064", "text": "