Anibel - Edges Inspiration Board#19
Open
anibelamerica wants to merge 12 commits intoAda-C10:masterfrom
Open
Conversation
Inspiration BoardWhat We're Looking For
|
| this.state = { | ||
| cards: [], | ||
| url: this.props.url, | ||
| boardName: this.props.boardName, |
There was a problem hiding this comment.
If the URL and board name aren't going to be changed within this component, you don't need to keep them in state. If you read them from props throughout the app, it will be more clear that they're read-only.
| const POST_INSPO_CARDS_URL = this.props.url + '/' + this.props.boardName + '/cards'; | ||
| axios.post(POST_INSPO_CARDS_URL, cardData) | ||
| .then((response) => { | ||
| cardData.id = response.data.card.id; |
There was a problem hiding this comment.
I like that you've kept all the API interaction logic in one component - the callbacks are a little more complex, but I would say it makes the app as a whole much easier to comprehend. Whether or not you intended it, this is a great example of the container component pattern well-applied.
| resetState = () => { | ||
| this.setState({ | ||
| text: '', | ||
| emoji: '' |
There was a problem hiding this comment.
Good use of a helper method here. Could you call this from your constructor instead of repeating this work?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Inspiration Board
Congratulations! You're submitting your assignment!
Comprehension Questions
NewCardFormcomponent. Upon submission, these states are sent up to anewCardmethod in theBoardcomponent via a callback. The method posts a requests to the API and a new card is either successfully created or errors are stored in state. If the card is successfully created, theBoard's card state is updated with the new card.componentDidMount()to get the list of cards from the API so that I can set the state and rerender the component within that lifecycle.