Few notable things in React.js and a brief discussion.

Md. Abu Sufian
3 min readNov 9, 2020

React.js makes front end JavaScript much easier. It is an open-source JavaScript library maintained by Facebook. Here are a few things you should know about react.js!

SPA (Single Page Application):

Single Page Application is a kind of web application which does not require to load every page request of any kind of interactions happening in the page or following pages. SPA is not mandatory in react.js , react can be used in a website for additional interactivity, enhancing components.

JSX:

JSX stands for JavaScript extensible Markup Language. JSX is similar to HTML. JSX supports regular JS expression and ultimately converts into JavaScript which is run in browsers. Mostly JSX uses in react and determine how the user interface should look like. Any type of valid JavaScript tag can be used in JSX using curly braces.

Components:

Components are more like a jigsaw puzzle. In a puzzle, all parts make meaningful beautiful things. React components are small pieces in a web application like Header, Footer, Body, etc. All those together create a page meaningful to the user. Reusing of components improve code efficiency, a functional Header or Footer can be used just export and import from other components.

Props:

Props stand for properties, an important mechanism used for passing data from one component to another. Props data is read-only type, child component can’t change the data coming from a parent component so props are immutable. Mostly props are one-dimensional data flow, parent to child components. But with the callback function, there can be exceptions. Props data type could be anything like numbers, strings, arrays, functions, objects, etc.

State:

We use props to pass data from one component to another. but when we dealing with user input or data updates, props just couldn't do it for us. Then there comes “State”. State is the place where the date comes and state object store property values. The components re-render when a programmer changes something in a state object.

Hook:

Hooks allow a programmer to use react features without writing a class, react hook is a call to a special function. All the hooks begin with the word “use”, like useState, useEffect,useReducer, etc. Hooks work perfectly with existing code without messing around. React remember the hook’s state for future re-render. Hooks are easier to work with and testing the project.

Virtual DOM:

Virtual DOM is the JavaScript representation of the whole HTML document. Virtual DOM has the same property as real DOM but lacks the real power to change things on the screen. When a new element added to User Interface, a virtual DOM is created as an in-memory representation of an actual DOM. React update the virtual DOM, not the actual DOM.

Route:

React router enables the navigation among components for a user. Changing the URL, showing the different types of data to the user.

Lifecycle:

Every component in react has a lifecycle. A react component has four phases of the lifecycle as it follows, initializing, mounting, updating, unmounting. Every component creation process involves these methods.

Event Handler:

The handler responsible for changing the event of an object is called the event handler. Event handlers always use camel case like onClick, onChange, onMove, etc. We use an event handler to HTML input elements such as buttons. Every event handler serves a specific purpose in a code. We connect to the various event in a single component through event handlers.

React is a beginner-friendly library, easy to maintain, and the more you know about React the more you will fall in love with it.

--

--

Md. Abu Sufian
0 Followers

A stranger midst of a kenned crowd!