Retired
Beam me up Statey using ReactJS (retired)
621richkotze
Loading description...
React
Fundamentals
View
This comment has been reported as {{ abuseKindText }}.
Show
This comment has been hidden. You can view it now .
This comment can not be viewed.
- |
- Reply
- Edit
- View Solution
- Expand 1 Reply Expand {{ comments?.length }} replies
- Collapse
- Spoiler
- Remove
- Remove comment & replies
- Report
{{ fetchSolutionsError }}
-
-
Your rendered github-flavored markdown will appear here.
-
Label this discussion...
-
No Label
Keep the comment unlabeled if none of the below applies.
-
Issue
Use the issue label when reporting problems with the kata.
Be sure to explain the problem clearly and include the steps to reproduce. -
Suggestion
Use the suggestion label if you have feedback on how this kata can be improved.
-
Question
Use the question label if you have questions and/or need help solving the kata.
Don't forget to mention the language you're using, and mark as having spoiler if you include your solution.
-
No Label
- Cancel
Commenting is not allowed on this discussion
You cannot view this solution
There is no solution to show
Please sign in or sign up to leave a comment.
Old school React class components! Well, that was fun... in a way. Firstly I rewrited everything to functions and hooks, but it turned out the test env does not know what React.useState is. Rewrited everything back again. But enjoyed it nevertheless.
The kata's spec is very confusing: beaming people are supposed to be held in the
inTransit
properties. But then beaming 3 people should have them all beamed at once? Then what's the purpose ofinTransit
properties? They are supposed as a temporary storage, which means they shouldn't be tested (not to mention in reality it's not something that's actually needed).As mentioned below, poor kata design.
This comment has been hidden.
Love the idea of doing some React on here. We need more of it.
However, I'm not sure this kata is a good representation of how "Lifting Up State" should work. The state (the list of inhabitents in each location, in this case) should be stored in "their closest common ancestor", which would be
Universe
. TheUniverse
should pass two props (a transport handler and a list) down toPlanet
andStarship
. That setup would eliminate the need forcomponentWillReceiveProps
(which is now considered unsafe)This comment has been hidden.
This comment has been hidden.
Hey the method you gave for defining functions is very unique. It needs more ways to pass like passing down functions, and arguments furthur to child components or returning with an arrow function because just doing it your way is not a good practice. If it were just passing down the function with it's arguments to a component within both planet and starship, I would have ok'd that.
Hey, thanks for your feedback.
I'm not sure I fully understand what part you're saying is not good practice. Could you clarify with an example please?
This comment has been hidden.