Closed chadams closed 2 years ago
You can use lume components as react components. For example:
export default function Container({ comp }) {
return <>
<comp.Button text="example1" />
<comp.Button text="example2" />
</>
}
And then this component can be used in other jsx component or nunjucks:
<div>
{{ comp.Container() }}
</div>
The comp
argument is always available not only in the layouts but also the components.
FYI, I'm planning to implement the following syntax for components in nunjucks:
{% comp Container %}
{{comp.Button({text:"example1"})}}
{{comp.Button({text:"example2"})}}
{% endcomp %}
So this ease the use of nested components. But it's not implemented yet.
Given the template
What I really want is to slot content into a reusable component, like React
My initial thought is to pass in like this...
but is starting to look messy, is there a way to put JSX components inside NJK? or somehow pass NJK blocks to a NJK component?