私はフォームからデータを取得しています。送信ボタンを使用すると、データをnodejsサーバーに送信する必要があります。私は斧を使用してサーバーにデータを送信することができません。また私は何が問題であるかもしれない何かエラーを受け取っていないですか?斧を使用してサーバーにデータを送信できません
import React from 'react';
import axios from 'axios';
class Createstudent extends React.Component {
constructor(props) {
super(props);
this.state = {value: ''};
this.handleChange = this.handleChange.bind(this);
this.handleSubmit = this.handleSubmit.bind(this);
}
handleChange(event) {
this.setState({value: event.target.value});
}
handleSubmit(event) {
alert(this.state.value);
}
componentDidMount(){
axios.post('http://localhost:8080/create',{value:this.state.value})
.then(function(response){
console.log(response);
})
}
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>
);
}
}
export default Createstudent;
屋を自分のサーバーにその示すだけの花のブラケット –
側に正しく送信された反応から必ずデータを作ることができますかサーバ –
開発者モードのgotoネットワークで、urアプリケーションがリクエストを行うとurlとすべてのパラメータが渡されます。ヘッダのポストコール文字列パラメータをチェックします。エラー。 –