PDA

View Full Version : Route with parameters



SenyaMur
18 Dec 2017, 1:49 AM
I create ExtReact app use the follow commands:
npm install -g yo @extjs/generator-ext-react
yo @extjs/ext-reactand change
<Route path="/about" component={About} />
to
<Route path="/about/:username" component={About} />
and launch: npm start

When go to http://localhost:8081/about/Piter then ExtReact try load from incorrect path
http://localhost:8081/about/ext-react/ext.css?b385f3a096894ad7f464
http://localhost:8081/about/ext-react/ext.js?b385f3a096894ad7f464
http://localhost:8081/about/app.js?b385f3a096894ad7f464

How fix it ?

tristan.lee
23 Dec 2017, 12:21 AM
This is not an ExtReact issue. It's likely how the server is configured to handle real URLs. Dev builds use the webpack-dev-server so there may need to be additional configurations made to it to get those URLs to be handled correctly. I see that historyApiFallback is true already. Perhaps there is more necessary.

You can read more at the react-router docs: https://github.com/ReactTraining/react-router/blob/v3/docs/guides/Histories.md#configuring-your-server