Skip to content

Chore/update react context example #581

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 3 commits into from
Aug 27, 2020
Merged

Chore/update react context example #581

merged 3 commits into from
Aug 27, 2020

Conversation

ljosberinn
Copy link
Contributor

No description provided.

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.

Thanks! I've never thought about the makeWrapper idea. It makes sense to me. Now that I think about it though, we should probably go with the custom render approach for this page, would you be willing to update it to that? It would probably be helpful to add a comment referencing that page.

@ljosberinn
Copy link
Contributor Author

Sure, curious how you'd setup the changing props for the provider here then. Just extend options with providerProps or something similar?

const customRender = (ui, { providerProps, ...options }) => {
  return render(
    <NameContext.Provider {...providerProps}>
      {ui}
    </NameContext.Provider>,
    options
  );
}

because that'd feel odd to me.

@kentcdodds
Copy link
Member

@ljosberinn
Copy link
Contributor Author

Yeah I was just confused about adding a customRender just for those two tests. But I kinda missed the point given that it's an example anyways, so there you go, I hope :)

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.

Great! Thank you!

@kentcdodds kentcdodds merged commit bad7347 into testing-library:master Aug 27, 2020
@kentcdodds
Copy link
Member

@all-contributors please add @ljosberinn for docs

@allcontributors
Copy link
Contributor

@kentcdodds

I've put up a pull request to add @ljosberinn! 🎉

@ljosberinn ljosberinn deleted the chore/update-react-context-example branch August 27, 2020 19:16
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.

2 participants