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.
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
feat: Nutrition Game #70 #114
base: master
Are you sure you want to change the base?
feat: Nutrition Game #70 #114
Changes from 1 commit
c7043b9
9c92737
d0149e2
4529d8b
0df05c0
c89e1f2
3a5bd0d
9412b2c
d36a119
ce50230
93d4b4e
fe21b02
a674dfd
630f0ef
257bd35
cb1e486
ecd4f07
fb90329
b952bc4
7d36892
b179515
cb6e2c2
089d9df
79d4643
9b873e3
10f5d56
0add0f0
93e7719
79764f1
ae0bffe
30be061
7214c83
d19a758
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
imported but not used. Normally when you do
yarn start
in the console, you should see some warnings about lines where you import or define variables you do not use. You should remove them to get a cleaner code.Here is what I get when I run
yarn start
from your branchThere 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.
Some points which will be useful for tech interview about React (JSX syntax to be precise):
propName={propValue}
{}
for sting. FOr examplepropName={"some text"}
is same aspropName="some text"
true
. For example<Component isOpen />
is the same as<Component isOpen={true} />
.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.
Maybe this values could live outside of the component ....
const NUTRIMENTS = [ ... ]
and just used in the useStateconst [nutriments, setNutriments] = React.useState(NUTRIMENTS)
. That way the component is a bit more cleanThere 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.
nit: I prefer not to use abbreviations as they quickly become difficult to read and understand, specially for other developers. Plase use a whole word, more typing but better readability. In this cases I tend to use the suffix
..item
, something likenutrimentItem
that way I understand that it is the thing inside the loopThere 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.
I'd advice against this kind of implicit closing elements (
</Box>
) as the chance of forgetting or using it wrongly is relatively highThere 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.
plase see the coment below
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.
I assume it's a mistake. The
</Box>
is planned to be before the coma But that's not important.@Shmigolk I think you get confused by the MUI demo, because it's cells only contain strings/numbers, so they use
In our case, we want to render inputs which is a bit more complex.
I propose you the following strategy:
create a component
NutritionTableRow
as follow:Then you will be able to simplify your table content as follow:
The trickiest part being
updateValue
which is a function returning a function.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.
is
sx={{}}
needed?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.
I removed checkbox and leaved delete icon. Still working on it
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.
is
sx={{}}
needed?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.
what about using the map directly?, I mean, instead of first map to createData() and using that result