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

How to init vuerx to vue3 #148

Open
ElBidouilleur opened this issue Aug 11, 2022 · 3 comments
Open

How to init vuerx to vue3 #148

ElBidouilleur opened this issue Aug 11, 2022 · 3 comments

Comments

@ElBidouilleur
Copy link

Hi

How initialize vuerx in vue3 because the old version Vue.use not work in vue3
When I write app.use because app.use want Plugin_2 properties

import {createApp} from 'vue'
import {router} from "./utils/Router";
import App from "./App";

import translation_fr from './i18n/fr.json';
import translation_en from './i18n/en.json';
import {createI18n} from "vue-i18n";
import ClientSocket from "./sockets/ClientSocket";
import VueSocketIO from "vue-socket.io-extended";
import VueRx from "vue-rx";

const app = createApp(App)

const socket = ClientSocket.connect('http', '192.168.1.159', '3000');

const i18n = createI18n({
    locale: navigator.language.split('-')[0],
    fallbackLocale: 'fr',
    messages: {
        fr: translation_fr,
        en: translation_en
    }
})


app.component('App', App);

app.use(router);
app.use(i18n);
app.use(VueRx());
app.use(VueSocketIO, socket);


app.mount('#app')

Do you have an solution

Thanks

@doommm
Copy link

doommm commented Oct 29, 2022

I suggest using @vueuse/rxjs instead in vue3

@kormosp
Copy link

kormosp commented Feb 21, 2024

I suggest using @vueuse/rxjs instead in vue3

Did this work to anybody instead vue-rx?
I get the same error:

vue-rx.esm.js:310 Uncaught TypeError: Vue.use is not a function
    at vue-rx.esm.js:310:7
    at custom-ui.js:2:241
    at custom-ui.js:3:3

package.json

"vue": "^3.4.19",
"rxjs": "^6.6.7",
"vue-rx": "^6.2.0",
"vuex": "^4.1.0"

"devDependencies": {
"@vitejs/plugin-vue": "^5.0.4",
"@vue-macros/reactivity-transform": "^0.4.3",
"@vue/compiler-sfc": "^3.4.19",
"vite": "5.1.1",
"vite-plugin-static-copy": "^1.0.1"
},
import { createApp } from 'vue';
import Vue from 'vue';
import custom from "./custom.vue";
import VueRx from 'vue-rx';

const app = createApp(custom);
app.use(VueRx);
app.mount('#app')

@doommm
Copy link

doommm commented Mar 5, 2024

I suggest using @vueuse/rxjs instead in vue3

Did this work to anybody instead vue-rx? I get the same error:

vue-rx is incompatible with vue3 because vue3 didn't have Vue.use API(app.use). And it's recommended to use Composition API in vue3. So i recommend using VueUse.

see this document for more information: https://vueuse.org/functions.html#category=%40RxJS

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

No branches or pull requests

3 participants