Answers for "formik error focus"

0

formik error focus

export default class ScrollToError extends React.Component {
  componentDidUpdate(prevProps) {
    if (prevProps.submitCount !== this.props.submitCount && !this.props.isValid) {
      if (Object.keys(this.props.errors)[0] === this.props.name) {
        ReactDOM.findDOMNode(this.props.inputRef.current).scrollIntoView({ behavior: 'smooth' });
      }
    }
  }

  render() {
    return null;
  }
}
Posted by: Guest on November-11-2020

Code answers related to "TypeScript"

Browse Popular Code Answers by Language