skip to Main Content

Reactjs – React hooks and comparing object references

I have fallen into the too-many-rerenders trap while implementing my own hook. The hook itself looked like this: function useRegexValidate(value: string, regex: RegExp, errorMessage: string, deps: any[] = []): ValidationResult { const [result, setResult] = useState<ValidationResult>(ValidationResult.Valid); useEffect(() => { if…

VIEW QUESTION
Back To Top
Search