【发布时间】:2020-01-06 14:45:02
【问题描述】:
我的 ReactJS 应用程序在 http://localhost:3000/ 中运行。我将以下表单数据作为 POST 请求接收到我的 React 页面
<form action="http://localhost:3000/" method="post">
Employee Id: <input type="text" name="eid"><br>
Department Id: <input type="text" name="did"><br>
<input type="submit" value="Submit">
</form>
我的 react 应用应该能够处理这个 POST 请求并呈现如下的 UI
<h1>{eid}</h1>
<h1>{did}</h1>
我能够使用反应路由器处理 GET 请求,但难以处理 POST 请求。我怎样才能做到这一点?
【问题讨论】:
标签: reactjs react-router