Bring Vue-style runtime capabilities to React.
@vureact/runtime-core is the runtime adaptation package of VuReact.
It provides Vue-style reactive APIs, built-in component adaptations, and template directive utilities for React applications. It is useful both for progressive migration and for teams that want to keep part of the Vue development experience inside React.
English | 简体中文
- React developers who want Vue-style reactive APIs
- Projects that need
KeepAlive,Transition,Teleport, and similar Vue-style capabilities - Teams using
@vureact/compiler-coreand needing the runtime adaptation layer - Vue-to-React migration efforts that want to preserve part of the original authoring model
- It is not the Vue compiler; for source transformation, use @vureact/compiler-core
- It is not a direct port of the official Vue runtime into React
- It is not a full compatibility layer for all Vue ecosystem libraries
npm install @vureact/runtime-coreYou can also use:
pnpm add @vureact/runtime-core
yarn add @vureact/runtime-corereact and react-dom should satisfy >=18.2.0.
Common APIs include:
useVRefuseReactiveuseComputeduseWatchuseWatchEffect
Example:
import { useVRef, useWatch } from '@vureact/runtime-core';
function Counter() {
const count = useVRef(0);
useWatch(count, (newVal, oldVal) => {
console.log(oldVal, '->', newVal);
});
return <button onClick={() => count.value++}>{count.value}</button>;
}Common components include:
KeepAliveTransitionTeleportSuspense
Example:
import { KeepAlive } from '@vureact/runtime-core';
function App() {
return (
<KeepAlive include={['UserPanel']} max={5}>
<UserPanel />
</KeepAlive>
);
}You can use Vue-style helpers in JSX, such as:
vClsvStylevOnvKeyless
Their goal is not to replicate Vue template syntax exactly, but to make some high-frequency patterns more ergonomic in React JSX.
There are two common cases:
- You are using
@vureact/compiler-coreand need to run the compiled output - You are not using the compiler, but still want Vue-style runtime capabilities in a React project
In short, compiler-core handles compilation, while runtime-core handles runtime adaptation.
Default entry:
import { useVRef, useWatch, KeepAlive } from '@vureact/runtime-core';Category-based exports are also available:
@vureact/runtime-core/adapter-hooks@vureact/runtime-core/adapter-components@vureact/runtime-core/adapter-utils
These are useful when you want imports grouped by capability.
The reactive implementation in this package is built on top of valtio, which provides Proxy-based reactivity.
- @vureact/compiler-core - Vue-to-React compiler and CLI
- @vureact/router - Vue Router to React Router adaptation
MIT License © 2025 Ruihong Zhong (Ryan John)