I wonder how React manages state internally.
To tell you a little bit more, I wonder how the inside of useState() also works so that the state is reactive!
useState(); I know that hooks provide state and state change functions as return values.
const [testState, setTestState] = useState('test');
I'm curious to see how it works inside React.
useState give you a back array and you can destructure that array the first element is state and the second one is a function that can change state often is called setState and to if the state is reference type you should first clone it and change reference to component re-rendered and if the state is not reference type you cane easily change state with setState without cloning original state