-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Develop #1769
base: master
Are you sure you want to change the base?
Develop #1769
Conversation
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.
Nice, but your code needs some changes
src/App.tsx
Outdated
</td> | ||
return ( | ||
<main className="section container"> | ||
{selectedGood === '' ? ( |
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.
{selectedGood === '' ? ( | |
{!selectedGood ? ( |
src/App.tsx
Outdated
data-cy="ClearButton" | ||
type="button" | ||
className="delete ml-3" | ||
onClick={() => this.setState({ selectedGood: '' })} |
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.
you have handler handleRemoveGood
key={index} | ||
data-cy="Good" | ||
className={ | ||
selectedGood === good ? 'has-background-success-light' : '' |
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.
selectedGood === good ? 'has-background-success-light' : '' | |
'has-background-success-light' : selectedGood === good |
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.
className={
selectedGood === good && 'has-background-success-light'
}
Type 'false | "has-background-success-light"' is not assignable to type 'string | undefined'.
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.
Yea i guess that this syntax requires classnames
package
src/App.tsx
Outdated
<td> | ||
{selectedGood === good ? ( | ||
<button | ||
data-cy="RemoveButton" | ||
type="button" | ||
className="button is-info" | ||
onClick={this.handleRemoveGood} | ||
> | ||
- | ||
</button> | ||
) : ( | ||
<button | ||
data-cy="AddButton" | ||
type="button" | ||
className="button" | ||
onClick={() => this.handleSelectGood(good)} | ||
> | ||
+ | ||
</button> | ||
)} | ||
</td> |
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.
just change your content(+/-) using condition, and improve your handleRemoveGood by checking inside is selected good === good, and clear if true
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.
Good job! Left some comments for future reference.
key={index} | ||
data-cy="Good" | ||
className={ | ||
selectedGood === good ? 'has-background-success-light' : '' |
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.
Yea i guess that this syntax requires classnames
package
{goods.map((good, index) => { | ||
return ( | ||
<tr | ||
key={index} |
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.
Using the index as a key is not a good practice. In this case, it doesn’t matter, but remember to avoid it. If you have a unique value, use that instead.
DEMO LINK