- Views: 21
- Report Article
- Articles
- Internet
- Internet Marketing
Practical Uses of ReactJS: Conceptual Overview
Posted: Mar 17, 2019
In that tutorial we learned how to configure a development environment based on Node.js because we want to develop frontend apps with React.js productively, and install the Webpack and Babel packages to automate these repetitive tasks :
- Build a single filebundle.js with the dependencies of modules solved
Did you manage to execute the hello world? Surely yes.
The first time you set up your Node.js environment it seems that you have to do a lot of things but when you get the hang of it it is very easy, and in the end you become productive!
And now that?Yes, that super app printed a hello world on the screen, but we still have not explained anything about the operation of React because the goal was to configure our environment. Soon I will come with a couple of practical examples, but first let me explain the key points of the React philosophy :
- Declarative programming
This is quite theoretical. You will only understand 100% when you have executed and understood a few practical examples. Have a little patience.
Oh, before I forget to say it. In order to follow this post you need to know how HTML and JavaScript work, and you should also have some experience programming JS apps.
1. Declarative programmingUnlike JavaScript and jQuery, where we manipulate the DOM manually, step by step, in a completely granular and imperative way, React wraps the DOM API in a declarative programming paradigm centered on the GUI components.
In case you do not know, in imperative programming one has to express step by step how he wants to do things while in declarative he says what he wants to do and that's it.
The problem with JavaScript and jQuery is that being imperative, developers have complete freedom to do what they want. The less experienced end up writing espagheti code, although those with more experience and apply OOP in their designs write a good and maintainable JS code.
In my humble opinion, the Facebook proposal is good because it puts us in an EC6 object-oriented development scenario where we apply good programming practices from the minute zero. It is something like a standard or a pattern of development, as you prefer to call it.
Be that as it may, ReactJS Support is a radical chip change because it completely abstracts you from how to manipulate the DOM, and in the end you end up writing little code, applying good programming practices, which is what it is all about.
2. GUI components that reactReact.js provides a novel conceptual framework based on components. The components are the elements that make up the user interface, for example a button, a clock, a search engine, etc. In React all are components!
React you forget forever to manipulate the DOM because the components react to both the events produced by the user and the server, repainting themselves when a change of state occurs. Hence the name of the library.
3. JSXEach time a component (button, clock, search engine, etc.) updates its status JS / jQuery developers end up repainting a certain piece of HTML code in the DOM. We spent half a lifetime repainting the elements of the GUI imperatively, however it is very tedious because you have to write a lot of code.
JSX is an XML-inspired JavaScript extension that facilitates the re-painting of DOM elements.
Look at this example:
render ( ) { return ( Hello world! ) ;}Thanks to JSX we understand from a glance what our code is painting: a label h1with the text Hello world!.
4. Virtual DOMReact does not work directly with the DOM because it is expensive in terms of performance, but with a JavaScript object that simulates it : the virutal DOM. When a state change occurs in the application, React only paints the nodes that are strictly necessary to reflect that change.
5. FluxFlux is a React application design architecture created by Facebook that simplifies frontend development, helping build robust and easy-to-maintain apps. Its three key pieces are the views (React components), the dispatcher and the warehouses, and it uses this unidirectional scheme :
React? Dispatcher? Warehouse? React
In short, a React component responds to an event and propagates the action to the central dispatcher. Next, the data model is updated, which launches another event, and the React components involved respond by repainting themselves.
Looking for ReactJS support online? Contact us for Job Support now and get a positive response from our side not in days but in a few hours!
About the Author
Subhash is Ceo of Yexaa and technical writer. He writes informative and unbiased articles to provide essential knowledge to the readers.
Rate this Article
Leave a Comment