A JSX layout engine.
TL;DR: Configure raptor with knowledge of your views and view model hierchy ("layout"). Then give it a blob of view models and it will stitch together the appropriate JSX for you.
raptor.addViews({UserList, UserItem});
These are only pages/routes/containers by convention. Strictly speaking, they are simply named layouts.
raptor.addLayout('Users', {
contacts: {
$view: 'UserList',
$children: {
$view: 'UserItem',
$props: {phone: 'secondary'},
},
},
});
TODO: Allow layouts to be nested/composed via the $layout
key.
raptor.render('Users', {
contacts: [
{id: '1', name: 'Foo Guy', phone: '(619) 555-7380', email: '[email protected]'},
{id: '2', name: 'Bar Guy', phone: '(858) 555-7380', email: '[email protected]'},
{id: '3', name: 'Herp Guy', phone: '(415) 555-7380', email: '[email protected]'},
{id: '4', name: 'Derp Guy', phone: '(650) 555-7380', email: '[email protected]'},
],
});
This will output something like the following JSX:
<UserList>
<UserItem> ... </UserItem>
<UserItem> ... </UserItem>
<UserItem> ... </UserItem>
<UserItem> ... </UserItem>
</UserList>
This list is incomplete.
- Nested layouts.