|
|
|
@ -622,6 +622,17 @@ The previous section for updating state can often be overly complex when dealing
|
|
|
|
|
|
|
|
|
|
|
|
1. Replace handleChangeName with a form submission handler that references the text input
|
|
|
|
1. Replace handleChangeName with a form submission handler that references the text input
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
```HTML
|
|
|
|
|
|
|
|
<form onSubmit={this.handleFormSubmit}>
|
|
|
|
|
|
|
|
{this.state.username}
|
|
|
|
|
|
|
|
<input
|
|
|
|
|
|
|
|
ref="username"
|
|
|
|
|
|
|
|
type="text"
|
|
|
|
|
|
|
|
placeholder="Your Name"/>
|
|
|
|
|
|
|
|
<input type="submit" value="Log In"/>}
|
|
|
|
|
|
|
|
</form>
|
|
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
```JavaScript
|
|
|
|
```JavaScript
|
|
|
|
handleFormSubmit(event){
|
|
|
|
handleFormSubmit(event){
|
|
|
|
event.preventDefault();
|
|
|
|
event.preventDefault();
|
|
|
|
|