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

Why is ReactDOM used? #4028

Closed
corradin opened this issue Feb 14, 2018 · 1 comment
Closed

Why is ReactDOM used? #4028

corradin opened this issue Feb 14, 2018 · 1 comment

Comments

@corradin
Copy link

After creating an application the App test file contains a unit test and it uses ReactDOM to test that the component is not crashing. Wouldn't it be better to use the React test renderer or Enyme with the mount command? From https://reactjs.org/docs/react-dom.html I understand that ReactDOM should be used for functionality rather than testing.
Please let me know what you think, thanks!

@gaearon
Copy link
Contributor

gaearon commented Feb 14, 2018

Test renderer and/or shallow rendering would probably be a better idea in any cases. But we wanted to show the simplest setup possible. One problem with the test renderer is that as soon as you add something that depends on DOM (e.g. Bootstrap or similar), your tests start to fail. Now you have to explain how to mock things out, test components separately, etc. Our users are often beginners and this is a huge topic. So we went with a bare minimum that would work.

@gaearon gaearon closed this as completed Feb 14, 2018
@lock lock bot locked and limited conversation to collaborators Jan 20, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants