-
Notifications
You must be signed in to change notification settings - Fork 734
Update React Redux recipe to use custom render with wrapper #424
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
Update React Redux recipe to use custom render with wrapper #424
Conversation
docs/example-react-redux.md
Outdated
| <div> | ||
| <button onClick={this.decrement}>-</button> | ||
| <span data-testid="count-value">{this.props.count}</span> | ||
| <h1>{this.props.count}</h1> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
h1 after h2? Let's leave this alone.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My bad, missed it sorry.. Will fix.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@alexkrolick Fixed it, thanks..
Also refactored the class component to a functional one in the current time spirit :)
kentcdodds
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me! Just one thing.
docs/example-react-redux.md
Outdated
| import { fireEvent, screen } from '@testing-library/react' | ||
| // We're using our own custom render function and not RTL's render | ||
| import { render } from './test-utils.js |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In accordance with the setup suggestions, this should be:
| import { fireEvent, screen } from '@testing-library/react' | |
| // We're using our own custom render function and not RTL's render | |
| import { render } from './test-utils.js | |
| // We're using our own custom render function and not RTL's render | |
| // our custom utils also re-export everything from RTL | |
| // so we can import fireEvent and screen here as well | |
| import { render, fireEvent, screen } from './test-utils.js |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated it and also added the export to the test-utils.js file..
Thanks!
kentcdodds
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Super! Thank you!!
|
@all-contributors please add @MatanBobi for docs |
|
I've put up a pull request to add @MatanBobi! 🎉 |
Updated the React Redux recipe to use a custom
renderwith thewrapperoption.Also refactored the class component to a functional component.
This PR is following the talk with @kentcdodds in this PR.