Answer the question
In order to leave comments, you need to log in
Injecting React static files into a website?
I have a react project created via create-react-app. After executing npm run build, files appear in the build folder, including index.html and a static folder with css and js files. I naively thought that these pages are enough to embed a react page into the site, but I only see a blank screen, although the page has a root div, but nothing works.
Answer the question
In order to leave comments, you need to log in
Your empty pages are shown because in the folder with the already finished project (build) in the index.html file, the paths to the style files and the JS file (where all the logic lies) are not indicated. In order to fix this:
1. You can correct the index.html file.
For example, specify "./bundle.js" in the script tag, if only this file is next to index.html
2. Use the Publishing Instructions and publish the project to the server
3. The most correct one. Use the instructions for launching the React application here
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question