#376 Stale Refs

easy
react

We have a simple input and button. The onClick handler of the button is made with useRef. Though we are updating state of value on every keystroke, on click of button shows undefined value in the console. Why? What can we do to fix it?