I'm still upgrading my knowledge about react-router-dom and Reactjs, I've built some project who end up using react-router-dom for my router, and somehow when I make it in develop mode (localhost:3000/detailevent/4) it works well in case of sending params to another function, but, when I deploy it to firebase, it got stuck, every time I go to www.somewebpage.com/detailevent/4 it just got a blank page, what just happened? did I need to change something in case of "production"?
oh ya, this is my code just in case you guys need to see:
//in App.js
<Router>
<Switch>
<Route exact path="/">
<Home />
</Route>
<Route exact path="/katalog">
<Listkatalog />
</Route>
<Route exact path="/video">
<Video />
</Route>
<Route exact path="/sejarah">
<Sejarah />
</Route>
<Route exact path="/detailevent/:id" component={Detailevent} />
</Switch>
</Router>
And this is the code in Detailevent.js
//in Detailevent.js
componentDidMount() {
console.log("ID: " + this.props.match.params.id);
const ref = firebase
.firestore()
.collection("jadwal")
.doc(this.props.match.params.id);
ref.get().then((doc) => {
if (doc.exists) {
const item = doc.data();
this.setState({
key: doc.id,
judul: item.judul,
keterangan: item.keterangan,
deskripsi: item.deskripsi,
nowa: item.nowa,
selectedDate: item.selectedDate,
url: item.url,
});
} else {
console.log("No such document!");
}
});
}
If I run it in my localhost (localhost:3000/detailevent/4), it works, all good, but after I deploy it on my firebase, Detailevent.js always got stuck when I access www.somewebpage.com/detailevent/4 (using the url that firebase generate) (not in my localhost, my project in localhost still good and accessable), did you guys know what happened?
EDIT: I got 404 error page (blank page)