opendevs
Conditional Rendering

Component Lifecycle Phases

Loading video...

Lifecycle Phases in React (in Hindi)

Concepts

    1

    Lifecycle Phases in React (in Hindi)
    Lifecycle Phases in React (in Hindi)

    2

    useEffect in React (in Hindi)
    useEffect in React (in Hindi)

    3

    Cleanup in useEffect (in Hindi)
    Cleanup in useEffect (in Hindi)
Each component has several lifecycle phases that you can leverage to run code at particular times in the process. The three phases are: Mounting, Updating, and Unmounting. Mounting: Mounting is the phase of the component lifecycle when the initialization of the component is completed and the component is mounted on the DOM and rendered for the first time on the webpage. Updating: A component is updated whenever there is a change in the component's state or props. Unmounting: This is the final phase of the lifecycle of the component that is the phase of unmounting the component from the DOM.Finish watching the concept videos to earn    DevCoin image  each
1

Which of these is a phase of the component lifecycle? Select all that apply.


Question 1 of 10
2

What's the best place to perform side effects in functional components?


Question 1 of 10
3

Component is mounted every time it rerenders.


Question 1 of 10
4

Side effect function in useEffect is always called after component has rendered.


Question 1 of 10
5

Which of these is an example of side effects in functional components? Select all that apply.


Question 1 of 10
6

What's true about the code below? Select all that apply.

function Component({ someRandomProps }) { const [count, setCount] = useState(0) document.title = count return <button onClick={() => setCount(count + 1)}>Increment</button> }

Question 1 of 10
7

What's wrong with the code below?

function Component() { const [count, setCount] = useState(0) useEffect(() => { console.log("I am called after component has rendered") }) return <button onClick={() => setCount(count + 1)}>Increment</button> }

Question 1 of 10
8

Which of the following statements are true about useEffect and side effects? Select all that apply.


Question 1 of 10
9

If the side effect in useEffect is executing on every rerender, what are some of the possible reasons? Select all that apply.


Question 1 of 10
10

Which of the following statements are true about useEffect and cleanup function? Select all that apply.


Question 1 of 10
Practice Problems
StatusTitleDifficultyDevCoin image

easy

medium

medium

medium

Copyright © 2022 opendevs

Learn ● Develop ● Ace
All illustrations by Storyset