Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dynamic live component #519

Closed
evansorenson opened this issue Nov 4, 2021 · 3 comments
Closed

Dynamic live component #519

evansorenson opened this issue Nov 4, 2021 · 3 comments

Comments

@evansorenson
Copy link

evansorenson commented Nov 4, 2021

Hello! I am trying to render live components dynamically by passing a component module name through the assigns. I found the dynamic component, but that doesn't work for my use case with live components obviously as I need to store state and handle events. Is there a way around this currently or is this something you are looking to add? Would be happy to help out in any way.

Also, was thinking the components (and live components) could be dynamically rendered using by passing their module name as such below instead of having to use the Dynamic component and then pass the module name. Not sure what exactly is done under the hood to convert the components to html, so maybe this isn't possible.

Current setup
<Dynamic.Component module={@component} id={@some_id} prop1={@prop1} />

Proposed dynamic components
<{@component} id={@id} prop1={@prop1} />

@tiberiuc
Copy link
Contributor

tiberiuc commented Nov 4, 2021

I opened a PR for dynamic live component ( check this PR #518 )
Dynamic.Component is only for stateless components so it cannot render stateful components ( live components ) that is why I suggested Dynamic.LiveComponent for stateful components , you can check it and see if it is working for you

@evansorenson
Copy link
Author

Can't believe I didn't see your issue haha. I tested with your branch and can confirm it works! Great stuff!

@Malian
Copy link
Collaborator

Malian commented Nov 6, 2021

Closed in favour of #516

@Malian Malian closed this as completed Nov 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants