Skip to content

Instantly share code, notes, and snippets.

@stephane777
Last active August 14, 2020 10:05
Show Gist options
  • Select an option

  • Save stephane777/5601dc9c3325f8041ef1bb49903b429b to your computer and use it in GitHub Desktop.

Select an option

Save stephane777/5601dc9c3325f8041ef1bb49903b429b to your computer and use it in GitHub Desktop.
### OPEN Webpack.config.js
Without this the browser will say :"I don't have instruction on how to handle the url with the query string!"
The modification will be redirected to the index.html page and then React Router can handle the change and send the right Route.
output :{
publicPath: '/'
}
devServer :{
historyApiFallback: true
}
### Extract of compile log when running npm start
「wds」: Project is running at http://localhost:8080/
「wds」: webpack output is served from /
「wds」: Content not from webpack is served from /Users/steph08/Documents/Documents - Steph07's MacBook Pro/Tyler McGinnis/React/Hacker-News
「wds」: 404s will fallback to /index.html
「wdm」: wait until bundle finished: /
「wdm」: Hash: 89d19e8bb9e62da2c26a
import { BrowserRouter as Router, Route } from "react-router-dom";
## Passing props to a Route component
<Route
path='/'
render={(props)=> <Component {...props} propsTopass={propsTopass}>}>
</Route
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment