Skip to content

Sigrid Benezra - Edges - Inspiration Board#20

Open
sdbenezra wants to merge 5 commits intoAda-C10:masterfrom
sdbenezra:master
Open

Sigrid Benezra - Edges - Inspiration Board#20
sdbenezra wants to merge 5 commits intoAda-C10:masterfrom
sdbenezra:master

Conversation

@sdbenezra
Copy link

Inspiration Board

Congratulations! You're submitting your assignment!

Comprehension Questions

Question Answer
Explain the steps in creating a new Card from the form. When you type your message or choose an emoji into the form, the form state updates. When you hit the Add Message button the state is saved in a variable that is passed to the addCardCallback passed through props from the Board.js file. That callback function does an axios post and also updates the Board's state which renders all the cards again including the new one.
How did you learn how to use the API? I reviewed the docs on Github and tried out the get, post, and delete methods with Postman.
What function did you use to place the GET request from the API to get the list of cards? Why use that function? I used componentDidMount(). It's run once when the board component is mounted, and we only need to retrieve the cards from the API once when we first start our app. Subsequent changes in cards are handled by the functions that post and delete cards.
Explain the purpose of a Snapshot test. The purpose of the snapshot test is to check if your components are rendering properly.
What purpose does Enzyme serve in testing a React app? Enzyme provides a function called shallow that allows us to limit the depth of rendering to one level so we can do basic testing of a parent without having to worry about child components causing errors.

@tildeee
Copy link

tildeee commented Dec 20, 2018

Inspiration Board

What We're Looking For

Feature Feedback
Core Requirements
Git hygiene x
Comprehension questions x
General
Card Component renders the data provided as props x
Board Component takes a URL and renders the list of Cards and passes in callback functions x
NewCardform Component is a controlled form and uses a callback function to return entered data to the parent component x
API
GET request made in componentDidMount x
DELETE request made in callback function x
POST request made in callback function passed to NewCardForm component. x
Snapshot testing mostly missing tests
Styling x
Overall

Nicely done on this Sigrid! I have a few comments on code style, and you're largely missing snapshot testing, but otherwise it's a good submission. Good work


addCardCallback = (cardInfo) => {
// console.log("Board message - addCardCallback triggered");
axios.post('https://inspiration-board.herokuapp.com/boards/sig/cards', cardInfo)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, it'd be nice if you could have used the props boardName and url with this too

console.log(`This is the index from card props: ${this.props.index}`);
console.log(`This is the id from card props: ${this.props.id}`);
this.props.onDeleteCallback(this.props.index, this.props.id);
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might make more sense to define this function deleteCard outside of render but still within Card. Then, to reference it, you would use this.deleteCard


Card.propTypes = {

onDeleteCallback: PropTypes.func,
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would expect index, id, text, and emoji to be declared in propTypes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants