Skip to content
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

docs(renderHook): remove references to error and all from renderHook API #963

Merged
merged 2 commits into from
May 3, 2022

Conversation

mpeyper
Copy link
Contributor

@mpeyper mpeyper commented Apr 27, 2022

Summary

Correct the renderHook API docs as result.error and result.all were not included in the new RTL version of renderHook. I also fixed a typo and renamed a test example to better describe what it is showing (both in the same file).

Test plan

No testing is required other than reviewing the documentation changes.

Copy link
Member

@mdjastrzebski mdjastrzebski left a comment

Choose a reason for hiding this comment

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

Good job for spotting the difference with RTL.

Could you update docs to take into account generic parameters Result and Props used by renderHook and RenderHookResult as currently API.md is mentioning any

all: Array<any>
current: any,
error: Error
current: any
Copy link
Member

Choose a reason for hiding this comment

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

Since RenderHookResult accepts generic Result parameter we should use it instead of any here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I hope my changes align with what you were thinking for this.

A React component to wrap the test component in when rendering. This is usually used to add context providers from `React.createContext` for the hook to access with `useContext`. `initialProps` and props subsequently set by `rerender` will be provided to the wrapper.
A React component to wrap the test component in when rendering. This is usually used to add context providers from `React.createContext` for the hook to access with `useContext`.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

While fixing the types, I also noticed that this is not true for your implementation either.

@mpeyper mpeyper requested a review from mdjastrzebski May 1, 2022 23:18
Copy link
Member

@mdjastrzebski mdjastrzebski left a comment

Choose a reason for hiding this comment

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

Looks good! Thanks for applying type comments.

@mdjastrzebski mdjastrzebski merged commit 3fa42d5 into callstack:main May 3, 2022
@mpeyper mpeyper deleted the docs/renderHook-corrections branch May 4, 2022 12:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants