Skip to content

Commit

Permalink
Update Session 8 Theory.md
Browse files Browse the repository at this point in the history
fix typo
  • Loading branch information
sameerkali authored Sep 27, 2023
1 parent ec9e5c1 commit 6fe050f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Chapter 08 - Let's get Classy/Theory/Session 8 Theory.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ For more reference [React-Lifecycle-methods-Diagram](https://projects.wojtekmaj.

## Q: Why do we use `componentDidMount`?
A: The `componentDidMount()` method allows us to execute the React code when the component is already placed in the DOM (Document Object Model). This method is called during the Mounting phase of the React Life-cycle i.e after the component is rendered.
Wwe can run any piece of react code to modify the components. For ex. It's the best place to `make API calls`.
We can run any piece of react code to modify the components. For ex. It's the best place to `make API calls`.


## Q: Why do we use `componentWillUnmount`? Show with example.
Expand All @@ -82,4 +82,4 @@ The main difference between super() and super(props) is the this.props is undefi


## Q: (Research) Why can't we have the `callback function` of `useEffect async`?
A: `useEffect` expects it's callback function to return nothing or return a function (cleanup function that is called when the component is unmounted). If we make the callback function as `async`, it will return a `promise` and the promise will affect the clean-up function from being called.
A: `useEffect` expects it's callback function to return nothing or return a function (cleanup function that is called when the component is unmounted). If we make the callback function as `async`, it will return a `promise` and the promise will affect the clean-up function from being called.

0 comments on commit 6fe050f

Please sign in to comment.