Skip to content

Instantly share code, notes, and snippets.

@elierotenberg
Created June 8, 2015 15:21
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save elierotenberg/6d3b7d4d3751c4ea0103 to your computer and use it in GitHub Desktop.
Save elierotenberg/6d3b7d4d3751c4ea0103 to your computer and use it in GitHub Desktop.
Composing @Nexus.component
@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