1export default class ScrollToError extends React.Component {
2 componentDidUpdate(prevProps) {
3 if (prevProps.submitCount !== this.props.submitCount && !this.props.isValid) {
4 if (Object.keys(this.props.errors)[0] === this.props.name) {
5 ReactDOM.findDOMNode(this.props.inputRef.current).scrollIntoView({ behavior: 'smooth' });
6 }
7 }
8 }
9
10 render() {
11 return null;
12 }
13}
14