Caroline Nardi - Inspiration Board - Octos#35
Conversation
Inspiration BoardWhat We're Looking For
|
| } | ||
|
|
||
| onClickButton = () => { | ||
| this.props.deleteCardCallback(this); |
There was a problem hiding this comment.
I'm not sure if there's a specific rule about this in React, but I think it's generally not considered best practice to pass a component instance itself to a callback.
In the deleteCard function from the Board component we're only using the id and index props, so we could just pass those directly instead.
| import { shallow } from 'enzyme'; | ||
|
|
||
| describe('Card', () => { | ||
| test('shallow mount', () => { |
There was a problem hiding this comment.
It could also be helpful to have additional tests for Card which check the snapshot if the component is rendered with a specific set of props.
Right now we're providing the id, index, and deleteCardCallback props, but none of these impact on the rendering. I think we could have further tests which provide the text and emoji props (one for each, and a third for when both are provided), as those props do impact the visual result.
Inspiration Board
Congratulations! You're submitting your assignment!
Comprehension Questions