Skip to content

Composition API in-depth guide #119

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

Closed
4 of 8 tasks
NataliaTepluhina opened this issue Jun 17, 2020 · 6 comments · Fixed by #131
Closed
4 of 8 tasks

Composition API in-depth guide #119

NataliaTepluhina opened this issue Jun 17, 2020 · 6 comments · Fixed by #131
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@NataliaTepluhina
Copy link
Member

NataliaTepluhina commented Jun 17, 2020

We already have Composition API basics document (thanks @shentao !) but we also need to have an in-depth guide similar to what we have for Components In-Depth. While working on it, we could move part of the descriptions from Composition API reference and Reactivity APIs as they're waaaay too detailed for API reference.

Here is a rough structure of the section:

  • setup()
    • props and context as setup() parameters
  • Reactive state with ref and reactive
    • Template refs
    • Destructuring reactive to refs
  • Computed and watchers (maybe we'd need to split this to separate chapters as watchers will contain a lot of info)
  • Lifecycle hooks
  • Provide/inject in the Composition API

Please keep in mind this is very rough draft and I would be happy to add any fixes/improvements to it

@NataliaTepluhina NataliaTepluhina added the enhancement New feature or request label Jun 17, 2020
@NataliaTepluhina NataliaTepluhina added this to the alpha milestone Jun 17, 2020
@NataliaTepluhina
Copy link
Member Author

cc @bencodezen @shentao

@kiaking
Copy link
Member

kiaking commented Jun 17, 2020

Lifecycle Hooks

I think it's worth mentioning about lifecycle hook usage, and describe how magically it works inside setup hook. The name are bit different than option API too.


Reactivity Utilities

I think it would be nice to have section for Reactivity Utilities and Advanced Reactivity APIs.

I think these are too detailed to include in section such as "Reactive state with ref and reactive", so it might be nice to have separate section after "Provide/inject in the Composition API"?

Or maybe those are going to be listed in API reference, and have link in the each section...? (like "learn more advanced usage at page".

@NataliaTepluhina
Copy link
Member Author

@kiaking thanks! Lifecycle hooks added

Utilities and Advanced APIs mentioned in the API Reference . Do you think it's worth adding a section covering Advanced use-cases to guide too?

@kiaking
Copy link
Member

kiaking commented Jun 17, 2020

Roger about APIs mentioned in API Reference.

Do you think it's worth adding a section covering Advanced use-cases to guide too?

I think it would be nice to have. But not sure if we should add those at this stage. It might also suit more at examples or cookbook. So, my opinion is not to add advanced use-cases at this stage. I think we can come back later with those 👍

@shentao
Copy link
Member

shentao commented Jun 17, 2020

The outline looks good to me! Will try to contribute to at least a few points.

I think that some of the Reactivity Utilities could be incorporated into the in-depth Composition API guide, but the Advanced Reactivity APIs are likely too niche to add them smoothly. Instead, I think we should just have a note in the guide when showing the unref and 'toRefs' functions (likely the most popular) that there are more utilities related to reactivity.

@bencodezen bencodezen self-assigned this Jun 17, 2020
@bencodezen
Copy link
Member

Thanks so much for outlining this @NataliaTepluhina. I'll take the lead on this one and let everyone know when we have a draft to review.

For anyone else who sees anything we can add to the guide, please comment on the issue and I'll be sure to track it!

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

Successfully merging a pull request may close this issue.

4 participants