buxlabs/boxwood
The issue has been closed
component and partial props #685
Manborough posted onGitHub
This is a cool library, there seems to be quite a lack of server side component libraries for JS. I wanted to ask if there's any way currently to pass props between components and partials?
Given this
const view = await render('./app/views/one.html', {states: state })
// Render is just a wrapper around boxwood so I can pass in a template file and get back html.
it seems that in the component the state property seems to be global and can be accessed directly from layout. Perhaps it could be walled off instead and passed in directly like vue or svelte would.
something like this.
// template_file_1.html
<import layout from="./layout.html" />
<layout sub_state={state.events} >
Slotted content
</layout>
//layout.html
<if sub_state.state>
{sub_state.name}
<end>
<slot/>