DEV Community

Taseenul Hoque Bappi
Taseenul Hoque Bappi

Posted on

Get some knowledge on REACT.js-

JSX

JSX is standard for JavaScript XML. it helps write HTML code in react.
Code Example:

const element = <h1>Hello, world!</h1>;
Enter fullscreen mode Exit fullscreen mode

JSX is like a template language but it has the full power of JavaScript. JSX produces react elements that are rendered in the DOM section. Most of the people JSX use in react for visualization in UI side. JSX is useful for reactjs because it shows more error and warning messages.

React Component Lifecycle

React’s has different lifecycle methods. A component’s lifecycle is classified into 4 parts:

  1. initialization
  2. mounting
  3. updating
  4. unmounting.

Initialization:

In this phase, the component is going to start by setting up the state and the props. This is generally done inside the constructor method.

Mounting:

Mounting is the phase-in React component mounts on the DOM section. This phase comes when the initialization phase is completed. In this phase, react component renders the first time. The methods that are available in this phase are:

componentWillMount() and
componentDidMount()

Updating:

The 3 no phase through that react component passes. The component has created, when the mounting phase is done. This is the phase where components state change and re-rendering. There are 3 methods on this phase:

shouldComponentUpdate()
componentWillUpdate()
ComponentDidUpdate()

Unmounting:

Unmounting is the last phase in the component’s lifecycle. In this phase, the component gets unmounted from the DOM. In this phase method is:

componentWillUnmount()

Top comments (0)