title: To preserve the value over time, store it in a useRef Hook and keep the mutable value in the '.current' property
body: <p>I am writing a custom hook I need to send update value from useEffect but isValid value is lost and sends always false did i missed something in useEffect or i am using this in incorrect way</p>
  <pre><code> export const useBasicValidity = (numb, name, dd, month, year) =&gt; {
    let isValid = false;
  
   const checkIsValid = (numb, name, dd, month, year) =&gt; {
        // some validation checks 
      return boolean value;
      };
    useEffect(() =&gt; {
        isValid = checkIsValid(numb, name, dd, month, year);
        }, [numb, name, dd, month, year]);
  
     return isValid;
    };
  </code></pre>