Support hooks in custom components (state, addEvents) (#2234)

This commit is contained in:
Masen Furer 2023-11-30 09:59:09 -08:00 committed by GitHub
parent a2d5bbc133
commit 3c7af9fad4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 0 deletions

View File

@ -22,6 +22,9 @@ export const {{component.name}} = memo(({ {{-component.props|join(", ")-}} }) =>
}
{% endif %}
{% for hook in component.hooks %}
{{ hook }}
{% endfor %}
return(
{{utils.render(component.render)}}
)

View File

@ -254,6 +254,7 @@ def compile_custom_component(
"name": component.tag,
"props": props,
"render": render.render(),
"hooks": render.get_hooks(),
"custom_code": render.get_custom_code(),
},
imports,