Vue and React Interoperability Adapter

0.2.7 · abandoned · verified Sun Apr 19

Vuera is a library designed to enable seamless interoperability between Vue.js and React applications, allowing developers to use Vue components within a React app and vice-versa. It facilitates migration scenarios or the co-existence of both frameworks in a single codebase. The current stable version is 0.2.7. The project appears to have an infrequent release cadence and is currently seeking a new maintainer, indicating a low level of active development. Key differentiators include its dual-framework compatibility and the use of Babel and Vue plugins for simplified integration, abstracting away much of the manual wrapping historically required for such interop solutions. The project's status as 'looking for a maintainer' is a significant factor for potential users.

Common errors

Warnings

Install

Imports

Quickstart

Demonstrates how to integrate a React component into a Vue application using Vuera's Vue plugin, including configuring shared Vue instance options.

import Vue from 'vue'
import { VuePlugin, config } from 'vuera'
import MyReactComponent from './MyReactComponent'

// Configure global Vue instance options for wrapped Vue components
// For example, if you have a Vuex store or i18n plugin
const myStore = {}; // Placeholder for your Vuex store
config.vueInstanceOptions = { store: myStore };

Vue.use(VuePlugin)

// Example Vue component using a React component
const app = new Vue({
  el: '#app',
  data: {
    message: 'Hello from Vue, rendered by React!',
    reactProp: 'Initial value'
  },
  methods: {
    handleReset() {
      this.reactProp = 'Reset value from React!';
      console.log('Reset event received from React!');
    }
  },
  components: {
    'my-react-component': MyReactComponent
  },
  template: `
    <div>
      <h1>Vue App</h1>
      <p>{{ message }}</p>
      <my-react-component :message="reactProp" @reset="handleReset" />
    </div>
  `
});

// In MyReactComponent.js (simple example)
// import React from 'react';
// const MyReactComponent = ({ message, onReset }) => (
//   <div>
//     <h2>I'm a React Component</h2>
//     <p>Prop from Vue: {message}</p>
//     <button onClick={onReset}>Reset</button>
//   </div>
// );
// export default MyReactComponent;

view raw JSON →