reading-notes

Class-04 reading Summary

Forms

You add a form with React like any other element.

class MyForm extends React.Component {
  render() {
    return (
      <form>
        <h1>Hello</h1>
        <p>Enter your name:</p>
        <input
          type="text"
        />
      </form>
    );
  }
}
ReactDOM.render(<MyForm />, document.getElementById('root'));

form

Handling Forms

Submitting Forms

You can control the submit action by adding an event handler in the onSubmit attribute.