Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

documentation: Update verbiage to be more readable #204

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
kentcdodds merged 1 commit into epicweb-dev:main from CNate:grammar-suggestion
May 4, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 11 additions & 6 deletions src/exercise/02.md
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ Elaborate on your learnings here in `src/exercise/02.md`

Memoization: a performance optimization technique which eliminates the need to
recompute a value for a given input by storing the original computation and
returning that stored value when the same input is provided. Memoization is a form
of caching. Here's a simple implementation of memoization:
returning that stored value when the same input is provided. Memoization is a
form of caching. Here's a simple implementation of memoization:

```typescript
const values = {}
Expand Down Expand Up @@ -122,7 +122,7 @@ React.useEffect(() => {
}, [updateLocalStorage]) // <-- function as a dependency
```

The problem with that though it will trigger the `useEffect` to run every
The problem with doing that is that it will trigger the `useEffect` to run every
render. This is because `updateLocalStorage` is defined inside the component
function body. So it's re-initialized every render. Which means it's brand new
every render. Which means it changes every render. Which means... you guessed
Expand Down Expand Up @@ -227,8 +227,8 @@ some fancy things with dependencies (dependency arrays are the biggest challenge
to deal with when making custom hooks).

NOTE: In this part of the exercise, we don't need `useCallback`. We'll add it in
the extra credits. It's important that you work on this refactor first so
you can appreciate the value `useCallback` provides in certain circumstances.
the extra credits. It's important that you work on this refactor first so you
can appreciate the value `useCallback` provides in certain circumstances.

## Extra Credit

Expand Down Expand Up @@ -305,7 +305,12 @@ function that people can call in their own `useEffect` like this:
```javascript
// 💰 destructuring this here now because it just felt weird to call this
// "state" still when it's also returning a function called "run" 🙃
const {data: pokemon, status, error, run} = useAsync({ status: pokemonName ? 'pending' : 'idle' })
const {
data: pokemon,
status,
error,
run,
} = useAsync({status: pokemonName ? 'pending' : 'idle'})

React.useEffect(() => {
if (!pokemonName) {
Expand Down

AltStyle によって変換されたページ (->オリジナル) /