Skip to content

Conversation

@AntiraLoachote
Copy link

@AntiraLoachote AntiraLoachote commented Oct 14, 2018

Changes proposed in this pull request:

  • Change <ul> to <ol> show a list
  • Change to arrow function
  • Remove generate-id form date now because we can use render key with index

- change ul to ol for list
- change to arrow function
- remove generate id form date now because we can use render key with index
);
}

handleChange = e => this.setState({ text: e.target.value });
Copy link
Owner

Choose a reason for hiding this comment

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

If arrow functions are used then the bindings won't be required anymore. This code is trying to illustrate in which case bind should be used for this.

return (
<ol>
{this.props.items.map((item, index) => (
<li key={index}>{item.text}</li>
Copy link
Owner

Choose a reason for hiding this comment

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

Using index is not recommend as per react docs, rather a unique id of the item is preferred.

Copy link
Owner

Choose a reason for hiding this comment

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

Here maybe that hasn't been followed in the item.id but the idea is clear, preferably not use any index/iterator values.

@ajayns
Copy link
Owner

ajayns commented Nov 19, 2018

Hey, thanks for the PR! I've added some comments.
One piece of advice when working with OSS projects it's better if you could match the coding style already followed. Maybe I should be using something like Prettier to ensure this, but as of now it's not done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants