1.

How To Use Forms In Reactjs?

Answer»

In React’s virtual DOM, HTML Input ELEMENT presents an interesting PROBLEM. With the others DOM environment, we can render the input or textarea and thus allows the browser MAINTAIN its state that is (its value). we can then get and set the value implicitly with the DOM API.

In HTML, form elements such as <input>, <textarea>, and <select> itself maintain their own state and update its state based on the input provided by user .In React, components’ mutable state is handled by the state property and is only updated by setState().

  • HTML <input> and <textarea> components USE the value attribute.
  • HTML <input> checkbox and radio components, checked attribute is used.
  • <option> (within <select>) components, selected attribute is used for select box.

In React’s virtual DOM, HTML Input element presents an interesting problem. With the others DOM environment, we can render the input or textarea and thus allows the browser maintain its state that is (its value). we can then get and set the value implicitly with the DOM API.

In HTML, form elements such as <input>, <textarea>, and <select> itself maintain their own state and update its state based on the input provided by user .In React, components’ mutable state is handled by the state property and is only updated by setState().



Discussion

No Comment Found