Uncontrolled components

"React also has uncontrolled components where the value prop is not passed to the input".

render() {
    return (
      <input type="text" />
    );
  }

"In this case, the value entered by the user will be immediately reflected in the input. For setting some default initial value, we can pass the default value prop, which will act as the initial value for an uncontrolled component."

render() {
    return (
      <input type="text" defaultValue="Shawn"/>
    );
  }

"Awesome. This does it."

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset