Skip to content

feat: testHook returns result ref object #297

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
merged 1 commit into from
Feb 12, 2019

Conversation

danielkcz
Copy link
Contributor

@danielkcz danielkcz commented Feb 12, 2019

What: Added ability to access return value of custom hook call without requiring to use closures for it.

Why: #295 (comment)

How: Using ref object approach similar to useRef hook

Checklist:

  • Tests
  • Typescript definitions updated
  • Ready to be merged
  • Added myself to contributors table - N/A

No tests were harmed by this change which actually surprised me a lot and my current mental capacity is unable to explain how is it possible 🤕

Fixes #295

Copy link
Member

@kentcdodds kentcdodds left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me! Thanks @FredyC!

@kentcdodds kentcdodds merged commit 2bbf924 into testing-library:master Feb 12, 2019
@kentcdodds
Copy link
Member

🎉 This PR is included in version 5.8.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@danielkcz danielkcz deleted the testhook-return branch February 12, 2019 18:17
lucbpz pushed a commit to lucbpz/react-testing-library that referenced this pull request Jul 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Return value of hook run with testHook?
2 participants