Skip to content

add usage that pass setup function to defineComponent #455

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

Merged
merged 1 commit into from
Sep 14, 2020
Merged

add usage that pass setup function to defineComponent #455

merged 1 commit into from
Sep 14, 2020

Conversation

unbyte
Copy link
Contributor

@unbyte unbyte commented Sep 5, 2020

No description provided.

```js
import { defineComponent, ref } from 'vue'

const HelloWorld = defineComponent(function HelloWorld() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpick: could we change the syntax here to ES6?

Suggested change
const HelloWorld = defineComponent(function HelloWorld() {
const HelloWorld = defineComponent(HelloWorld() => {

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

However, it's not a valid js(ts) syntax 😂. function is used to keep the document concise, because if use arrow function, code in document should be like

const HelloWorld = () => {
    ....
}

// since `HelloWorld` is already defined in the scope, use `HelloWorldComponent` instead
const HelloWorldComponent = defineComponent(HelloWorld)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I didn't pay enough attention when was writing the suggestion 🤦🏻 You're right

@NataliaTepluhina NataliaTepluhina merged commit b3d7b6a into vuejs:master Sep 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants