Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upReactWrapper#update example is incorrect #2348
Open
Labels
Comments
|
Thanks, I agree some improvements are needed. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The code example for ReactWrapper's
updatemethod (https://github.com/enzymejs/enzyme/blob/master/docs/api/ReactWrapper/update.md#example) is incorrect.I'll reproduce it here:
The first issue is that the initial render output is "1" not "0" because the counter is incremented on the first render before
this.valueis used in the return value. The second issue is that incrementing the counter is exactly what doesn't happen when usingwrapper.update()(unlikewrapper.setProps()).I didn't just submit a PR to fix these two details because I think a bigger revision is needed to illustrate the difference between
wrapper.update()andwrapper.setProps({})more clearly, but I'm not sure what yet.