-
Notifications
You must be signed in to change notification settings - Fork 546
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
Question about the functional API with function components #61
Comments
The second example misses improvements of function-based component API over both React Hooks and
Moreover, |
Thanks for the replies. What I don't understand is how you would take advantage of the improvements of the api if you are just returning createElement or jsx from the setup function. Mentally it would probably make more sense to me if jsx was still returned from the render function.
Maybe I'm reading the RFC wrong in regards to manually rendering. |
So the thing is in a functional component there is no state, no hooks and no computed, there are only props, that's why it's not concerned by the function api |
Yes. Thank you. I understand that now. I was just wondering what using jsx would look like with the composition functions api. I'm excited about the additions. |
originally in rfc #42 there were both |
@bskimball putting the setup code along side the JSX expression means all the code needs to be run on every single render. This creates all kinds of issues mentioned here, which is exactly what we are trying to avoid. |
I'm curious to what functional components would look like in Vue 3. Obviously the talk of the town is adding setup() and the examples show using createElement and templates. I like jsx and currently use it in Vue and I also like React + hooks, but for the same reasons @yyx990803 and @Akryum have noted, it could be improved. I have already tried out the vue-function-api plugin which only seems to work with templates at this time.
I assume in Vue 3 a typical component with jsx would look like this
I also have used the vue-hooks package and I really like that api, for it's simplicity, and as you can see in the example above the object only has 1 function. This makes me think an actual functional component would just return the setup.
What I have in this example would be the preferred api for me. I was wondering if this is what the Vue team had envisioned. Thank you.
The text was updated successfully, but these errors were encountered: