I have a simple HTML form:
<form method="post" action="http://localhost:3000">
<input value="val" name="nam" />
<button type="submit">Launch</button>
</form>
Now I have a react application which runs on localhost:3000
as follow:
import React from 'react';
import ReactDOM from 'react-dom';
import App from 'components/App/App';
class IndexClass extends React.Component {
render() {
return (
<BrowserRouter>
<Switch>
<Route path="/" exact component={App}/>
</Switch>
</BrowserRouter>
);
}
}
ReactDOM.render(<Index/>, document.getElementById('root'));
Now, If I type localhost:3000
in my browser url bar, I can successfully launch the application. But If I try to launch my application from simple html form, I get an error:
Cannot POST\
Screenshot:
https://cdn.pbrd.co/images/I0My0wZ.png
I think this is because of post method. How do I solve it?