Last active
November 10, 2018 23:26
-
-
Save cj/1213a0bcbd62827c684c3e26bc11b20d to your computer and use it in GitHub Desktop.
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
import m from 'mithril' | |
import User from '../models/User' | |
const Container = '.p-10.bg-pri' | |
const UserListItem = { | |
view({ attrs: { user } }) { | |
return ( | |
<div class="user-list"> | |
{user.firstName} {user.lastName} | |
</div> | |
) | |
}, | |
} | |
const UserList = { | |
oninit: User.loadList, | |
view() { | |
if (User.loading) return <div>Loading ...</div> | |
return ( | |
<Container> | |
<div class="user-list"> | |
{User.list.map(user => m(UserListItem, { user }))} | |
</div> | |
</Container> | |
) | |
}, | |
} | |
export default UserList |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment