Preparing search index...

    Function useResetOnChange

    • Runs onChange synchronously during render whenever any entry in deps changes, compared shallowly with Object.is against the previous render.

      This is React's "adjusting state while rendering" pattern: it replaces a useEffect that only mirrors props into state, avoiding the extra commit and the react-hooks/set-state-in-effect lint rule. onChange typically calls one or more state setters and reads the new values from the enclosing scope. It does not fire on the initial render.

      Parameters

      • deps: readonly unknown[]

        Values to watch; pass them as a fresh array each render, like a useEffect dependency list.

      • onChange: () => void

        Callback fired once per change of deps.

      Returns void