S
S
Stanislav Shabalin2021-04-06 01:02:54
React
Stanislav Shabalin, 2021-04-06 01:02:54

Native js or react?

I studied react a little in the hope of starting to put it into practice for the convenience of writing code and the ease of scaling the project with the possibility of reusing ready-made solutions in new projects.

What first caught my eye was the tangible tree-like structure of files, which will always grow with the increase in the project. Then the files have a lot of imports and exports to keep in mind. Inheritance and wrapping containers in a container, class inheritance, property forwarding and finally rendering. And, of course, the syntax, which you need to get used to and rebuild.

If I need, for example, to process a click on the Like or submit button to send a message to the server, then I will traditionally take and write functions: handling the click of an element, fetching and rendering changed data or a response in a modal window. All this in one or two files and a bit of code. In react, it seems to me that I have to do more work and touch more than two files. .

From here comes the question to the React connoisseurs: does it really make life easier and speed up the front-end development process as the project grows compared to native js or still alive jQuery? or is it just a trendy alternative framework with its own preferences and niche?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
Anvar Shakhmaev, 2021-04-06
@RxR

React

A
Alexander, 2021-04-06
@Seasle

At its core, React is not a framework. Think of it as a smart templating engine with its own peculiarities. Of course, during development, you can split the components into smaller ones, even to infinity, but it's better not to do this. React also allows you to do some things much easier than you would in native JS (For example, dynamically render collections of elements).

A
Anton, 2021-04-06
@karminski

You just didn't understand. Well, the most important and simple thing that React does and naive js does not do is store the state.
React does not impose any restrictions on the structure of project files. Importing and exporting allows you to get rid of code noodles and keep components as simple and readable as possible.
Of course, if you only need to add an event handler to a single button, React is overkill. The rest is just react.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question