-
-
Notifications
You must be signed in to change notification settings - Fork 8.8k
Closed
Description
What problem does this feature solve?
I like that you can pass a setup function into defineComponent however if you require props in your component you then need to pass a component options object.
What does the proposed API look like?
I want to simply do this:
const MyComp = Vue.defineComponent((p: { name: string }) => {
return <div>{p.name}</div>;
});
instead of
const MyComp = Vue.defineComponent({
props: {
name: String
},
setup(p) {
return <div>{p.name}</div>;
}
});
This makes it look much cleaner and decreases a level of indentation.
This is even cleaner and works without explicitly setting props:
const MyComp = (p: { name: string }) => {
return <div>{p.name}</div>;
};
however it only works as a "Functional Component" and does not keep state. React lets me define components like this. In React I use Mobx to get Vue like Reactivity so I need to wrap my components in Observerable(). I would love to get the best of both worlds and have elegant jsx components with the proxy based Vue reactivity.
Metadata
Metadata
Assignees
Labels
No labels