Closed neilmcguigan closed 1 year ago
You can! But it's barely mentioned in the docs :( (https://jinjax.scaletti.dev/guide/extra/#attrs-methods).
<Parent>
<Child __attrs={attrs} />
<Child />
</Parent>
attrs
are the parent attrs__attrs
begins with two underscoresIf you only want to pass some arguments (and you know which ones), you can do it like any other value (attrs
is similar to a dict)
<Parent>
<Child title={attrs.get('title') or 'Hello'} />
<Child />
</Parent>
Say I want a generic container component that can dynamically set args on declared child components
like this:
You can do this w Jinja macros (awkwardly):
where parent looks like this: