React - Questions

  1. What is Pure Components?
  2. Synatx of import in react component.?
  3. What is mounting, updating and unmounting?
1 Like

1.A Pure component is a function that does not modify any external variable.
2.import React, { Component } from ‘react’;
3.a.Mounting means adding nodes to the DOM.
b.Unmounting means removing nodes from the DOM.
c.Updating means making changes to nodes already
in the DOM

  1. Pure Components are Class Components which extends React.
    2.import React, { Component } from ‘react’;
  2. Mounting: Mounting is the stage of rendering the JSX returned by the render method itself.
    Updating: Updating is the stage when the state of a component is updated and the application is repainted.
    Unmounting: As the name suggests Unmounting is the final step of the component lifecycle where the component is removed from the page.
  1. a pure component implements shouldcomponentupdate() with a shallow propss and state comparision.
  2. import react,{component} from react;

1.Pure Components to provide optimizations.
2. importFrom.js , import.js
3. Mounting adding nodes to the DOM,
Unmounting removing them from the DOM


Pure component are component that does not rerenders if props or state does not change

import Header form Header.js
import React from ‘react’

mounting entering in dom
updating, if components update
unmounting, leaving from dom