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

[feature request] Support setup() returning render function with JSX #20

Closed
beeplin opened this issue Jul 3, 2019 · 7 comments
Closed
Labels
enhancement New feature or request

Comments

@beeplin
Copy link

beeplin commented Jul 3, 2019

@liximomo (related to #13) It would be great if we could do like this:

# compoennt.js
export default createComponent({
  setup() {
    const a = value(1)
    return () => <div> { a } </div>
})

This would make all type inference and refactoring super easy within VSCode.

@phiter
Copy link

phiter commented Jul 3, 2019

I don't think that's what setup() is meant to be, for components, since template is a separate option.
Also value unwrapping isn't clear here.

@IceSentry
Copy link

@phiter it's part of the RFC

https://github.com/vuejs/rfcs/blob/function-apis/active-rfcs/0000-function-api.md#usage-with-manual-render-functions

@phiter
Copy link

phiter commented Jul 21, 2019

Oh I see. You gotta access values with .value inside the jsx then.

@IceSentry
Copy link

IceSentry commented Jul 22, 2019

You don't necessarily have too use .value it's only when you use the value() wrapper. If you use state or anything that doesn't use .value then you don't need too. It's just that the example used a value() and this requires a .value

@beeplin
Copy link
Author

beeplin commented Jul 22, 2019

@IceSentry I am afraid that computed needs .value just like value.

@IceSentry
Copy link

Yes, you are right, I didn't check the RFC before posting, my point still stands that .value is not related to render functions. It's just that the example used that particular value() wrapper.

@liximomo
Copy link
Member

Supported in v2.2.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

5 participants