-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Implement use:Component actions. #1322
Comments
#1321 and #1322 together would turn this code: https://svelte.technology/repl?version=1.60.2&gist=196319d9223a4cde1db09b4a6805094c Into this code: https://svelte.technology/repl?version=1.60.2&gist=a736a723115f05d8aa0fbf1baeeccc2e I think that's a much cleaner and more Svelte-esque solution than manually manipulating the DOM like in https://github.com/sveltejs/svelte/blob/master/test/runtime/samples/action/main.html. |
I love this! |
Since there's no longer a way in Svelte 3 to distinguish whether something is being imported as a component, I don't think this syntax makes sense any longer. We don't want to have a runtime check that looks at whether what it's been given is an action or a component constructor. It would still be easy to implement this in userland as a custom action, or as a function that inputs a component constructor and outputs an action. |
Actions seem like a very easy way to use a component on an object, and would be very useful to implement components that simply added functionality to an existing element. Let's add a shortcut for instantiating a component as an action.
Basically turn this:
Into this:
The text was updated successfully, but these errors were encountered: