Skip to content
This repository was archived by the owner on Dec 9, 2021. It is now read-only.

Conversation

@codeBelt
Copy link
Owner

No description provided.

@codeBelt codeBelt requested a review from ccheney September 11, 2019 19:17
@codeBelt
Copy link
Owner Author

@mthomes
@n8rzz

Copy link

@n8rzz n8rzz left a comment

Choose a reason for hiding this comment

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

Couple points on this:

  • pay close attention to the key stuff. React needs them to be unique and by passing a model name, uniqueness isn't guaranteed. I'd encourage adding the map index to the end of it. This also isn't ideal, but a little better for uniqueness. lodash.uniqueid is another possible option
  • for these new methods, are you actually rendering or are you building? The Ranfeltian school suggests the structure: _buildThingWereBuildingJsx

As usual, these are nitpicks bordering on bike-sheding, so take what you'd like and go from there 😉

const { episodeTables } = this.props;

return episodeTables.map((model) => (
<div key={model.title}>
Copy link

Choose a reason for hiding this comment

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

what happens if there is another model with a same title? these keys need to be unique

Copy link
Owner Author

Choose a reason for hiding this comment

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

In this case I know that titles will be unique because I create them in the selector.

Copy link

Choose a reason for hiding this comment

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

How would react and/or an implementor know that? See also:

@codeBelt
Copy link
Owner Author

@n8rzz I made smaller component but add the map back in to the render method. What do you think?

@codeBelt codeBelt merged commit 991083f into JavaScript Sep 13, 2019
@codeBelt codeBelt deleted the map-breakout branch September 13, 2019 16:14
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants