Thursday, 25 October, 2018 UTC


When you refresh the page in JavaScript, it will clear values that you possibly want to be persisted if you don't store it somewhere as in localStorage. Storing something in localStorage is a side effect and in React 16.6 you can utilize `useEffect` to deal with exactly this type of situation. In this lesson, we'll use `useEffect` to set a state variable in `state` whenever `state` is updated. We'll also look at some optimizations available to us with `useEffect` so we don't have it running _every_ time the component renders.