-
Notifications
You must be signed in to change notification settings - Fork 351
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
Switch from using useRef() to createRef() #1603
Conversation
GeraldRequired Reviewers
Don't want to be involved in this pull request? Comment |
npm Snapshot: PublishedGood news!! We've packaged up the latest commit from this PR (71a7ef4) and published it to npm. You Example: yarn add @khanacademy/perseus@PR1603 If you are working in Khan Academy's webapp, you can run: ./dev/tools/bump_perseus_version.sh -t PR1603 |
Size Change: 0 B Total Size: 859 kB ℹ️ View Unchanged
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #1603 +/- ##
==========================================
- Coverage 70.52% 70.43% -0.09%
==========================================
Files 547 572 +25
Lines 107037 111539 +4502
Branches 5532 11867 +6335
==========================================
+ Hits 75485 78563 +3078
- Misses 31436 32976 +1540
+ Partials 116 0 -116 see 1119 files with indirect coverage changes Continue to review full report in Codecov by Sentry.
|
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.
LGTM and this makes sense, no re-renders so createRef
won't do any unwanted overwriting! Thanks for doing this, got me to look up the difference between useRef
and createRef
:)
Summary:
I noticed a test that was jumping through hoops with spies in order to manage a ref in tests. Using
React.createRef()
is simpler and avoids needing to mock a hook.Issue: "none"
Test plan:
yarn test
✅