質問編集履歴
1
見つけましたコードを追加しました。
test
CHANGED
File without changes
|
test
CHANGED
@@ -131,3 +131,75 @@
|
|
131
131
|
export default Calc;
|
132
132
|
|
133
133
|
```
|
134
|
+
|
135
|
+
```ここに言語を入力
|
136
|
+
|
137
|
+
class Layer extends React.Component {
|
138
|
+
|
139
|
+
constructor(props) {
|
140
|
+
|
141
|
+
super(props);
|
142
|
+
|
143
|
+
this.state = {value: 'coconut'};
|
144
|
+
|
145
|
+
|
146
|
+
|
147
|
+
this.handleChange = this.handleChange.bind(this);
|
148
|
+
|
149
|
+
this.handleSubmit = this.handleSubmit.bind(this);
|
150
|
+
|
151
|
+
}
|
152
|
+
|
153
|
+
|
154
|
+
|
155
|
+
handleChange(event) {
|
156
|
+
|
157
|
+
this.setState({value: event.target.value});
|
158
|
+
|
159
|
+
}
|
160
|
+
|
161
|
+
|
162
|
+
|
163
|
+
handleSubmit(event) {
|
164
|
+
|
165
|
+
alert('Your favorite flavor is: ' + this.state.value);
|
166
|
+
|
167
|
+
event.preventDefault();
|
168
|
+
|
169
|
+
}
|
170
|
+
|
171
|
+
|
172
|
+
|
173
|
+
render() {
|
174
|
+
|
175
|
+
return (
|
176
|
+
|
177
|
+
<form onSubmit={this.handleSubmit}>
|
178
|
+
|
179
|
+
<label>
|
180
|
+
|
181
|
+
Choose how many times you want to paint:
|
182
|
+
|
183
|
+
<select value={this.state.value} onChange={this.handleChange}>
|
184
|
+
|
185
|
+
<option value="grapefruit">1</option>
|
186
|
+
|
187
|
+
<option value="lime">2</option>
|
188
|
+
|
189
|
+
<option value="coconut">3t</option>
|
190
|
+
|
191
|
+
</select>
|
192
|
+
|
193
|
+
</label>
|
194
|
+
|
195
|
+
<input type="submit" value="Submit" />
|
196
|
+
|
197
|
+
</form>
|
198
|
+
|
199
|
+
);
|
200
|
+
|
201
|
+
}
|
202
|
+
|
203
|
+
}
|
204
|
+
|
205
|
+
```
|