General Question about scriptedRef() usage

G General February 03, 2023
Login to reply
Coded Themes Support Agent
1 year ago


Thanks for reaching out.

useScriptRef is a reference created for an entire app using the useRef() hook. 

Path: full-version/src/hooks/useScriptRef.js

The useRef() Hook allows you to persist values between renders. It can be used to store a mutable value that does not cause a re-render when updated. It can be used to access a DOM element directly.

Why do they exist in AuthLogin? => When the condition returns true, it means it has a still initial state and the page has not been navigated, in such a case, we may want to show/update some data on UI.

Hope that makes sense!

Feel free to reach out if any further questions.

Kind Regards,


George Oort
1 year ago

In AuthLogin, AuthRegistration, the forms use a useScriptRef hook. They haven't been capturing the error state well and I was wondering if someone could explain the use of those hooks to me and how they work.

const AuthLogin = () => {
  const [checked, setChecked] = React.useState(false);
  const scriptedRef = useScriptRef();
  return (
      onSubmit={async (values, { setErrors, setStatus, setSubmitting }) => {
          try {
          } catch (err) {
          if (scriptedRef.current) { // WHY??
              setStatus({ success: false });
              setErrors({ submit: err.message });

Additional Info

Order#: 47155

Purchase From?:

Name of Product/template: Mantis UI