Consume the values of a reference without major inconvenience

This hook has a behavior similar to useEffect but focused on resolving the consumption of one or more references.


import { useRef } from "atomico";
import { useRefValues } from "@atomico/hooks/use-ref-values";

function component(){
    const ref = useRef();
        // πŸ‘‡ current will be the value assigned to ref.current
            // 1️⃣ here the effect dependent on the reference
            // πŸ”΄ The following line is optional
            return ()=>{
            // (Optional) here the cleanup of the reference dependent effect
    return <host>
        <input ref={ref}/>

Last updated