According to your code, the useRef returns an object below:
{ current: 'Hello world!' }
Therefore, you can access the value in interest by using myVar.current property.
read more about Referencing Values with Refs on React.dev