Created
June 8, 2015 15:21
-
-
Save elierotenberg/6d3b7d4d3751c4ea0103 to your computer and use it in GitHub Desktop.
Composing @Nexus.component
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@component(() => ({ | |
users: ['remote://users', {}], | |
})) | |
@component(({ users }) => | |
users.mapKeys((userId) => | |
[`user:${userId}`, [`remote://users/${userId}`, { firstName: 'John', lastName: 'Doe' }]] | |
).toObject() | |
) | |
class UserList extends React.Component { | |
render() { | |
return _(this.props) | |
.filter((v, k) => k.startsWith('user:')) | |
.map((user) => <UserItem {...user} />) | |
.value(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment