Skip to content
This repository has been archived by the owner on Jun 7, 2024. It is now read-only.

Part 3 app.js UpdateDialog input key issue #50

Open
jamesyin96 opened this issue Apr 2, 2017 · 3 comments
Open

Part 3 app.js UpdateDialog input key issue #50

jamesyin96 opened this issue Apr 2, 2017 · 3 comments

Comments

@jamesyin96
Copy link
Contributor

Hi,

Thanks for this awesome tutorial. I learned good react design here. But I do find a place that could be better.

It's in Part 3 - Conditional Operations. In UpdateDialog component, when we define the form input, we set

<p key={this.props.employee.entity[attribute]}>

This works most of the time, but it can't guarantee the key uniqueness. If firstName = lastName, we will have a problem. If we set

<p key={attribute}>

It can solve this problem because attributes are different by design. I notice we use this key assignment in CreateDialog component. So UpdateDialog component should follow the same pattern, right?

Thanks

@gregturn
Copy link
Contributor

gregturn commented Apr 2, 2017

Well, the ideal key would be a "self" link URI.

@jamesyin96
Copy link
Contributor Author

Yes, that's even better. :)

@gregturn
Copy link
Contributor

gregturn commented Apr 2, 2017

Pull request welcome. Just be sure to hit each section. :)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

2 participants