Wednesday, 1 February 2017

What do you understand by Controlled vs. Uncontrolled Component? ReactJS Interview Question

Uncontrolled Components
In most cases, we recommend using controlled components to implement forms. In a controlled component, form data is handled by a React component. The alternative is uncontrolled components, where form data is handled by the DOM itself.

To write an uncontrolled component, instead of writing an event handler for every state update, you can use a ref to get form values from the DOM.

WHAT OTHERS ARE READING/RELATED TO THIS:

0 comments:

Post a Comment