How different is React components interaction from javascript and HTML in the DOM?
Answer
It is about a few different things on the approach, while you would normally have the browser rendering each HTML file with event listeners from your javascript file so we can interact with the DOM, then again, that makes us have to create multiple HTML pages with their own JavaScript file.
When we talk about components interaction, we do not even think about how they interact with the DOM, but it all happens before they communicate anything to the browser, so by having component interaction we can set any changes needed and once done, React sends them to the browser, so it becomes more efficient to provide content that way if it is mainly streamlined through JavaScript.
Hola,
You must have found differences between them by now.
Key takeaways to outline could be:
HTML is a markup language, while React is a JS library.
React is component-based, while HTML doesn’t support such a structure by default.
HTML can’t manage interactivity or states on its own; React can manage states.
HTML websites need full refresh, while React can update only elements that change.
React enables one-way data binding, while HTML doesn’t have any data binding by default.
HTML typically structures content for static websites. React builds dynamic app UIs.
I hope the following resources may be useful to you: