H
H
Hlib2019-06-06 20:03:48
JavaScript
Hlib, 2019-06-06 20:03:48

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

2 answer(s)
A
Anton Spirin, 2019-06-06
@Mysianio

Read about the webpack module builder and specifically about webpackDevServer and HtmlWebpackPlugin . You can run it npm run ejecton a test project and look in the files to see config/webpack.config.jshow config/webpackDevServer.config.jsit scripts/start.js's all set up and running.
If you execute npm run buildand open the directory , you will see all the generated files there. build/static

D
Dima Pautov, 2019-06-06
@bootd

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 question

Ask a Question

731 491 924 answers to any question