This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { compose, withHandlers } from 'recompose' | |
import { animateScroll } from 'react-scroll' | |
const scrollToFirstError = errors => { | |
const errorFields = errors | |
// Using breakable for loop | |
for (let i = 0; i < errorFields.length; i++) { | |
const fieldName = `position-${errorFields[i]}` | |
// Checking if the marker exists in DOM | |
const elements = document.querySelectorAll(`[name="${fieldName}"]`) |