Skip to content

Fully understand the why and how React work with inputs, what are controlled and uncontrolled inputs and advanced concepts to help you achieve desired result

Notifications You must be signed in to change notification settings

frankoadeleye/controlled-uncontrolled-with-hooks

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Solving The Controlled Input Problem Using UseRef Hook

(Kindly first checkout the problem here before continuing)

To solve this, the useRef() hook is introduced, which points to the DOM HTML element, where the change happens; but since we don't have any onChange handlers, we have completely eliminated unnecessary re-renders whenever we update the value in the input field. All the handleSubmit does is print the current value in the DOM element value only when the button is clicked.

Thanks for checking this out.

(Kindly leave a star if you find this helpful in your React journey)

About

Fully understand the why and how React work with inputs, what are controlled and uncontrolled inputs and advanced concepts to help you achieve desired result

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published