ref vs useState

I'm a bit confused on the useState function, when do it use it and does it completely replace ref?
Was this page helpful?