Reputation: 15262
I would like to know how to serve txt files like robots.txt and verify.txt in a ReactJS app?
Eg: http://localhost:3000/.well-known/apple-developer-merchantid-domain-association.txt
So far I have tried adding the files to the public folder, but the app does not recognize the URL.
Thanks in advance
Upvotes: 3
Views: 5028
Reputation: 15262
The following solution works for serving a static file via React JS React Router.
Solution via React Router
const reload = () => window.location.reload();
<Route path="/my-static-file.ext" onEnter={reload} />
Upvotes: 8