Skip to content

Support for React 15 Context #306

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

Closed
oscarkwan opened this issue Feb 22, 2019 · 4 comments
Closed

Support for React 15 Context #306

oscarkwan opened this issue Feb 22, 2019 · 4 comments

Comments

@oscarkwan
Copy link

oscarkwan commented Feb 22, 2019

Will there be support for the legacy context api for react-testing-library?

@kentcdodds
Copy link
Member

Hi @oscarkwan,

There is already. What about it is not working?

@oscarkwan
Copy link
Author

Hi @kentcdodds,

Thanks for your reply, I'm pretty new to all this and I couldn't find any documentation regarding support for react 15 legacy context api. All the documentation seemed to be about react 16 context.

Do you mind pointing me towards the right direction?

Cheers!

@kentcdodds
Copy link
Member

Well, it kinda depends on how your legacy context is setup, but the concept is the same whether you're using legacy context or current context. This is because react-testing-library doesn't allow you to test implementation details.

Anyway, here's an example: https://codesandbox.io/s/10w35qy5vq

Good luck.

@oscarkwan
Copy link
Author

Thanks so much, for the example. This is a good start for me. Still learning react and actually recently watching your javascript testing course.

Cheers!

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

No branches or pull requests

2 participants