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

feat: support vue 3.2 #66

Merged
merged 4 commits into from
May 22, 2023
Merged

feat: support vue 3.2 #66

merged 4 commits into from
May 22, 2023

Conversation

CJY0208
Copy link
Contributor

@CJY0208 CJY0208 commented May 6, 2023

Description

support vue 3.2 using effectScope

This change has been verified to work in my scoped npm package @cjy0208/reactivue

online demo: https://codesandbox.io/s/agitated-satoshi-c34t7u

I really like this tool and hope that this PR can help the 0.x version continue to work.

Linked Issues

#65
#64
#52
#51
#48
#45

Additional context

@antfu
Copy link
Owner

antfu commented May 9, 2023

I am not sure if we will keep working on the current version as @sibbng is doing a major rewrite at #46. @sibbng what do you think of the status of the PR and what would be the best approach we should do?

@sibbng
Copy link
Collaborator

sibbng commented May 9, 2023

I don't think reactivue is relevant since the release of EffectScope API. The advantage of reactivue over EffectScope is the support of Vue plugins and lifecycle hooks. Vue plugin support is limited to very simple ones and will not work in complex ones like vue-i18n and vue-router. Even if we get them working it is still not worth the overhead.

With the release of Composition API in Vue 3, most Vue plugins are now just simple utility hooks. VueUse is one of the best examples of this.

Previously, I have used VueUse hooks with effectScope in React, Svelte, Qwik, Solid, and some other small frameworks with their own way of managing lifecycle. It was really easy and straightforward.

If anyone is going to build something serious, I recommend them to explore first-party integrations instead. If you are a React user who wants to take advantage of Vue libs like VueUse, I would suggest you use EffectScope API.

@antfu I don't expect any more progress on #46. I'm in favor of deprecating reactivue and referring to effectScope docs.

@CJY0208
Copy link
Contributor Author

CJY0208 commented May 10, 2023

effectScope is not very easy for me to use. It's too simplistic and requires additional handling of HMR updates, lifecycle hooks, and integration with Vue ecosystem libraries such as vueuse and pinia.

If I need to use it in React, I might still wrap it in a useSetup-like function. However, these tasks have already been completed in reactivue.

reactivue is still valuable, but it currently just doesn't support Vue 3.2.

@antfu
Copy link
Owner

antfu commented May 16, 2023

To me, reactivue is more like a showcase of what it is being capable of. I don't use React anymore but I would like to see an option like this exists. Even it might not work with vue-router and vue-i18n or such, I still think it's valuable (as a toy or so) for those who do not enjoy React hooks' mental burden. effectScope to me is more like some good addition but not really replacing this lib as a whole.

@sibbng if you plan to discontinue #46, I am thinking of keeping the current approach but merging @CJY0208's work to make it up-to-date with minimal effort. Efficiency to me it not really relevant, as it's React after all :P

@sibbng
Copy link
Collaborator

sibbng commented May 16, 2023

@sibbng if you plan to discontinue #46, I am thinking of keeping the current approach but merging @CJY0208's work to make it up-to-date with minimal effort. Efficiency to me it not really relevant, as it's React after all :P

Yeah, I'm totally fine with that.

@antfu antfu merged commit 504a916 into antfu:master May 22, 2023
3 checks passed
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.

None yet

3 participants