From 43ed4f6230d6a6c2a687b1e1ab28517447018f41 Mon Sep 17 00:00:00 2001 From: Vikash Sahu Date: Sat, 30 Jan 2021 09:41:37 -0800 Subject: [PATCH] fix grammatical issues in useEffect section --- lessons/hooks-in-depth.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lessons/hooks-in-depth.md b/lessons/hooks-in-depth.md index 1b5c9ade..c586d345 100644 --- a/lessons/hooks-in-depth.md +++ b/lessons/hooks-in-depth.md @@ -20,7 +20,7 @@ In the preceding course, we went over `useState`, `useEffect`, `useContext`, and [Component][effect] -Effects are how you recreate `componentDidMount`, `componentDidUpdate`, and `componentDidUnmount` from React. Inside `useEffect`, you can do any sort of sidd-effect type action that you would have previously done in one of React's lifecycle method. You can do things like fire AJAX requests, integrate with third party libraries (like a jQuery plugin), fire off some telemetry, or anything else that need to happen on the side for your component. +Effects are how you recreate `componentDidMount`, `componentDidUpdate`, and `componentDidUnmount` from React. Inside `useEffect`, you can do any sort of side-effect type action that you would have previously done in one of React's lifecycle methods. You can do things like fire AJAX requests, integrate with third party libraries (like a jQuery plugin), fire off some telemetry, or anything else that needs to happen on the side for your component. In our case, we want our component to continually update to show the time so we use setTimeout inside our effect. After the timeout calls the callback, it updates the state. After that render happens, it schedules another effect to happen, hence why it continues to update. You could provide a second parameter of `[]` to `useEffect` (after the function) which would make it only update once. This second array is a list of dependencies: only re-run this effect if one of these parameters changed. In our case, we want to run after every render so we don't give it this second parameter.