react-vue

0.0.5 • Public • Published

react-vue.js

A fork of Vue, only modifies very litter code, extracts its reactivity core, and adds an observer function.

Install

npm install --save react-vue

Usage

import React, { Component } from 'react';
import Vue, { observer } from 'react-vue';
 
const store = new Vue({
  data () {
    return {
      count: 0
    }
  },
  methods: {
    increase () {
      this.count ++;
    }
  }
});
 
@observer
export default class Demo extends Component {
  render () {
    return <h1 onClick={store.increase}>{store.count}</h1>;
  }
}

As shown above, the data changes, the view updates. Most of your vue magic is still available in react, even if Vuex.

demo

API

Almost all api points to the vue's official document. If you are familiar with vue, there is no unknown usage.

Global

Options

Instance

observer

Inspiration from mobx, used to convert React components into reactive components.

@observer (decorator) is optional, observer(class Timer ... { }) achieves exactly the same.

Single File Components

Since react-vue only contains vue's reactivity system, there is no lifecycle, no template. For the full support of SFC, try react-vue-loader.

document

License

MIT

Readme

Keywords

Package Sidebar

Install

npm i react-vue

Weekly Downloads

24

Version

0.0.5

License

MIT

Last publish

Collaborators

  • smallcomfort