-
Notifications
You must be signed in to change notification settings - Fork 11
Tahuana's assignment #6
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
Open
tahuana
wants to merge
7
commits into
bridge-school:master
Choose a base branch
from
tahuana:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
6bde0d6
React-promise assignment: task 1, including stretch goal
tahuana 0b25393
React-promise assignment: task 2, NOT including stretch goals
tahuana f781dbb
.
tahuana 80c8b28
refactoring based on TA comments
tahuana e577d59
implementing: strech goal 3 - reusable function for API request; and …
tahuana f8638ec
improving error handling
tahuana 5c48f0e
adding a higher order component that conditionally show either an err…
tahuana File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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.
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.
It looks like you've got the concepts of a HOC down! Nice work 😄 - this is a really complicated concept!
One thing you could do to make this more generic is pass your props directly to your pass and fail components instead of manipulating the props here, similar to this:
Then you can use the data however you'd like within the component itself, which means you could pass any components to your
branchcomponent and reuse yourbranchcomponent multiple times.One other thing to double check is that you're passing your parameters into your HOC in the order you expect them - when you call this on line 67 you're passing 1) your condition, 2) your success component (Recipe) and 3) your fail component (Error). Here, you're rendering your
Errorcomponent as the success component (which I think is is what you actually want to render, since you're checking forhasError). It could be worth renaming yourtestboolean something likepassConditionor similar so it's clear that the first returned component is the one you want rendered if your condition is true. And if you want yourRecipecomponent to show with the success of your condition, you could change your boolean to!this.state.hasError.Excellent work with Higher Order Components!