Answer the question
In order to leave comments, you need to log in
How is React.js used in terms of website development? (What is its role)?
Hello. Tell me as a beginner, I don't understand. There are, for example, HTML + CSS that are responsible for the content of the page, as they say, layout, they usually write that javascript is used to introduce interactivity into the page and dynamics. Here I took an interest in the react, which allegedly itself creates components that are HTML elements. It turns out that in such cases, layout is not needed? Or all the same, how do sites with react? Or is react meant for something else? Thanks in advance.
Answer the question
In order to leave comments, you need to log in
The answer is very rude and for beginners (experienced developers will peck me for this, but still)
React is a framework and, accordingly, sets certain rules for developing the front of the site.
But if about how it works, then in short:
you create a certain component in react, and it, in turn, translates this same component into the same html code with styles, and adds all sorts of js interactivity to it.
Made for the convenience of developing sites (so that you do not write hundreds of lines of html, and then sweat and style it using css, and + to all this, you also need to set some properties to your block (component) using js, for example, to when you clicked on the button, the block was hidden.
As for the components in React, it is reminiscent of classes in OOP. Ie you create a class (component) it has properties and methods. In the properties of the class (component) you write the values that are necessary to build from this class (component) an already ordinary html tag and style it, and the methods of the class (component) are needed to draw this component and monitor its state
To understand (if it is not available described ) what I described in ROUGH language:
Article on Habré
react makes it possible to describe page elements with a mixture of javascript and html. This technology is called jsx. And you can add css to jsx files. That is, to put it simply, we describe a page element (called a component) in one file in which we write both js and html and also connect the css of this element there. And this is not the main feature of react, there is a lot more, for example, updating components when data changes.
so the layout is still needed.
React is used to write applications that run in the browser.
such receive data in the form of json and build html based on them.
when you click on the link, there is no page refresh, the data has changed - the interface has been rebuilt.
html is managed by react and they don't work with it directly, instead there is jsx.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question