Does useRef store address for variables?
const x = useRef(data);
const y = x;
I'll have two separate copies of data or one? What will be the memory consumption? What are the drawbacks of this method?
Does useRef store address for variables?
const x = useRef(data);
const y = x;
I'll have two separate copies of data or one? What will be the memory consumption? What are the drawbacks of this method?
I assume you would like to use JS as some other languages (C ?) - but keep in mind that they are differences. Check this answer: https://stackoverflow.com/a/21457798
Your example looks like trying of copy useRef object. Before you go to useRef, remember how to copy objects in JS example here: What is the most efficient way to deep clone an object in JavaScript?