Ref Demo - Update Value

How this works

When the page loads, we use this.yourRef.current.focus() to set focus on the input.
When we click on 'Increase Value' button, we use this.yourRef.current to read and increase the input value.

Don't Overuse Refs

Although we could use Refs to update the element, we should avoid using refs for anything that can be done declaratively.

Codepen Demo

https://codepen.io/deniapps/pen/dyMooJK