Here, I'm mimicking the functionality of useRef using useState. Like a couple of other things in the playground, this is an interesting quiz from bytes.dev.


  import { useState } from "react";

  export function useMyRef(initalValue: any) {
    const [ref] = useState({current: initalValue})

    return ref
  }

ref current = this is the current ref

../../components/useRef/UseRefDemo