I love Vue Composition API and its reactivity system, 
but functional components in React are also sweet with Typescript. 
Instead of making a choic

GitHub - antfu/reactivue: 🙊 Use Vue Composition API in React components

submited by
Style Pass
2022-06-22 09:00:08

I love Vue Composition API and its reactivity system, but functional components in React are also sweet with Typescript. Instead of making a choice, why not to use them together?

Yes, you can! Before you start, you need set alias in your build tool in order to redirect some apis from vue to reactivue or reactivue/preact if you are using it with Preact.

To alias within Rollup, you'll need to install @rollup/plugin-alias. The plugin will need to be placed before your @rollup/plugin-node-resolve.

Jest allows the rewriting of module paths similar to bundlers. These rewrites are configured using regular expressions in your Jest configuration:

Installing Vue plugins are almost identical to Vue. Just simply create your root instance with createApp function and register your plugins as you do in Vue apps. You don't need to call app.mount. Your Vue plugins will be available in all your setup functions.

Note: If you are trying to use a library that calls app.component, app.directive or app.mixin in its install function, reactivue will skip these calls without any action and warn you about it.

Leave a Comment