Skip to content

Commit

Permalink
Clarify conflicting advice
Browse files Browse the repository at this point in the history
  • Loading branch information
gaearon committed Jan 17, 2019
1 parent d7d5533 commit 1a49812
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion content/docs/hooks-faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ If we just wanted to set an interval, we wouldn't need the ref (`id` could be lo
// ...
```

Conceptually, you can think of refs as similar to instance variables in a class. Avoid setting refs during rendering -- this can lead to surprising behavior. Instead, only modify refs in event handlers and effects.
Conceptually, you can think of refs as similar to instance variables in a class. Unless you're doing [lazy initialization](#how-to-create-expensive-objects-lazily), avoid setting refs during rendering -- this can lead to surprising behavior. Instead, typically you want to modify refs in event handlers and effects.

### Should I use one or many state variables?

Expand Down

0 comments on commit 1a49812

Please sign in to comment.