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

corradin opened this Issue Feb 14, 2018 · 1 comment


None yet
2 participants
Copy link

corradin commented Feb 14, 2018

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 I understand that ReactDOM should be used for functionality rather than testing.
Please let me know what you think, thanks!


This comment has been minimized.

Copy link

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 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.