in Education by
What are Pure Components in React js1?

1 Answer

0 votes
by

React.PureComponent is exactly the same as React.Component except that it handles the shouldComponentUpdate() method for you. When props or state changes, PureComponent will do a shallow comparison on both props and state. Component on the other hand won't compare current props and state to next out of the box. Thus, the component will re-render by default whenever shouldComponentUpdate is called.

Related questions

0 votes
    What are props in React?...
asked Jun 2, 2021 in Education by JackTerrance
0 votes
    How to pass a parameter to an event handler or callback in REACT?...
asked Jun 2, 2021 in Education by JackTerrance
0 votes
    What is the difference between HTML and React event handling?...
asked Jun 2, 2021 in Education by JackTerrance
0 votes
    Why should we not update the state directly in React?...
asked Jun 2, 2021 in Education by JackTerrance
0 votes
    What is the difference between state and props in React?...
asked Jun 2, 2021 in Education by JackTerrance
0 votes
    What is state in React JS?...
asked Jun 2, 2021 in Education by JackTerrance
0 votes
    How to bind methods or event handlers in JSX callbacks?...
asked Jun 2, 2021 in Education by JackTerrance
0 votes
    What is the purpose of callback function as an argument of setState()?...
asked Jun 2, 2021 in General by JackTerrance
0 votes
    When to use a Class Component over a Function Component?...
asked Jun 2, 2021 in Education by JackTerrance
0 votes
    What is the difference between Element and Component?...
asked Jun 2, 2021 in Education by JackTerrance
0 votes
    What is JSX?...
asked Jun 2, 2021 in Education by JackTerrance
0 votes
    What are Higher Order Components in React js?...
asked Dec 5, 2020 in Technology by JackTerrance
0 votes
    This is part of the component : import MyComp from '../../lib/MyComp' const Data = ( { data } ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jul 26, 2022 in Education by JackTerrance
0 votes
    This is part of the component : import MyComp from '../../lib/MyComp' const Data = ( { data } ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jul 20, 2022 in Education by JackTerrance
0 votes
    My issue is basically this: I have a bunch of svg images all stored in a .js file like this ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 3, 2022 in Education by JackTerrance
...