Want to understand React better

Want to understand React better
0

#1

I’m trying to place my new knowledge of react in the context of the HTML-CSS-JS curriculum.

If I use React to build a web-page, do I no longer need a separate HTML file? As far as I can tell, all HTML is taken care of by the JSX code instead which is all going to be located in the JS file(s)…?


#2

You still have the HTML page, because remember, when you ReactDOM.render(), you’re placing your generated content into an HTML DOM node somewhere in the page. Doing this, for example, you could have a React chat app attached to a DOM node on an otherwise static page.

The way you generate the HTML is changed, and the way you handle CSS is dramatically different – they’re being generated rather than being statically coded. But HTML and CSS are still vital for your React apps.


#3

From what i understand, theres nothing particularly new about react other than you can now separate concerns by components rather than by file types. You still need to link a script to your html and still need to give a tag to render your component. Now instead of having a bunch of different html files that may use 1 or many js files, you have many js components connected to 1 html file, which just makes your project much easier to manage and impliment with functionality.

As for jsx, it still needs to be compiled to plain old javascript before the browser can use it. The html in jsx isnt actual html, its just a format that the compiler will use to convert back to js and just makes it easier for you to write components in javascript.


#4

You need at least one HTML page, because the browser still needs a document to render.