-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(gatsby-theme-docz): fix infinite renders in playground on hot reload
Reported in issue #1299
- Loading branch information
1 parent
8049cf7
commit 3451fd1
Showing
1 changed file
with
8 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3451fd1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rakannimer
Since it'll never change, you can put it in a
useRef
. Not sure if it'll matter, though3451fd1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep I agree !
Any reason you can think of on why ref should be preferred ?
3451fd1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
to be honest, it's probably not gonna matter much. since you're not changing it ever, you're not going to have any re-renders because of it. At that point it just boils down to good practice.
Back in the days, with class components, you'd typically place this on a class property - that's what refs are for in function components.