getSelectedElements typescript issue? #1229
-
Hi I did the following in order to delete a selected element
Typescript accepts it while developing but in runtime, the data is actually in If I do just
What am I missing? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 9 replies
-
Can you provide a reproduction for this issue? You can find a sandbox template here. I recommend you start using composition API instead of options API, though that is ultimately your choice of course but you'll make your life easier in the future 😄 |
Beta Was this translation helpful? Give feedback.
General rule of thumb: Composable are not meant to be used in callbacks / functions.
There are exceptions (since composables are ultimately just functions) but
useVueFlow
is not one of them.It's similar to React Hooks (but more flexible).
Call the composable in the setup body of your component (you can use any example on the vueflow docs as a reference to see how it's correctly used).
Or if you want to use
defineComponent
: