2023-02-26 01:02

This commit is contained in:
2023-02-26 01:02:16 +09:00
commit c7e119657c
50 changed files with 37116 additions and 0 deletions

36
hello_world/src/index.js Normal file
View File

@@ -0,0 +1,36 @@
import React from 'react';
import ReactDOM from 'react-dom';
class MyForm extends React.Component {
constructor(props){
super(props);
this.state ={value: ''};
this.handleSubmit = this.handleSubmit.bind(this);
this.handleChange = this.handleChange.bind(this);
}
handleChange(event){
this.setState({value: event.target.value});
}
handleSubmit(event){
console.log('Submitted: ' + this.state.value);
event.preventDefault();
}
render(){
return <form onSubmit={this.handleSubmit}>
<label>Name:
<input type="text" value={this.state.value} onChange={this.handleChange} />
</label>
<input type="submit" value="Submit" />
</form>
}
}
ReactDOM.render(
<div>
<MyForm />
</div>,
document.querySelector('#root'));