Answer the question
In order to leave comments, you need to log in
How reactjs connects to html file?
I do not quite understand how the react application finds the html file to which it needs to bind.
That is, we have create-react-app, we have an index.js file where the application is rendered to id='root' and an index.html file where this root is located
. How does index.js define this file? Didn't find any linking links.
Answer the question
In order to leave comments, you need to log in
Read about the webpack module builder and specifically about webpackDevServer and HtmlWebpackPlugin . You can run it npm run eject
on a test project and look in the files to see config/webpack.config.js
how config/webpackDevServer.config.js
it scripts/start.js
's all set up and running.
If you execute npm run build
and open the directory , you will see all the generated files there. build/static
Like all regular scripts, we connect react itself in the script tag, we connect index.js, inside which initialization is written on the root element
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question