Anish
Anish

Reputation: 33

Unexpected Rxjs VueRx error in created hook

I recently started working with VueRx and Rxjs. I am in the process of setting the basic. Somehow it gives me this error.

[Vue warn]: Error in created hook: "TypeError: 
rxjs__WEBPACK_IMPORTED_MODULE_0__.Observable.interval is not a 
function"

found in
 ---> <Home> at src/views/Home.vue

So I did the basic stuff as shown in the documentation. But It’s now working. This is what I have set up in main.js:

import * as Rx from 'rxjs'; 
// I tried without * and with * both not working
import VueRx from 'vue-rx';

Vue.use(VueRx, Rx);

and this is how my component looks like:

<template>
 <div class="home">{{ countdown$ }}</div>
 </template>

<script>
import { Observable } from 'rxjs';
export default {
 subscriptions() {
   const countdwon$ = Observable.interval(1000);
  countdwon$.pipe(100);
  return {
     countdwon$,
    };
  },
};
</script>

Upvotes: 1

Views: 257

Answers (0)

Related Questions