A lightweight, high-performance React-like framework
Fully compatible with React ecosystem, with built-in support for modern build tools
- 🧬 RSC Ready - Experimental React Server Components with SSR + Flight streams
- 🚀 React Compatible - Drop-in replacement for React with the same API
- ⚡ High Performance - Optimized reconciler with minimal overhead
- 🔧 Modern Tooling - First-class support for Vite, Next.js, Rspack, and Webpack
- 🔄 Fast Refresh - Built-in HMR support for instant development feedback
- 🎨 Multiple Renderers - DOM, Terminal, Three.js, and Lynx renderers out of the box
- 📱 Lynx Support - Build cross-platform native apps with Lynx dual-thread architecture
- 📦 Tree Shakeable - Optimized bundle size with ES modules
- 🧪 Experimental Features - Reactive programming model and more
- 🛠️ DevTools - Custom developer tools for debugging
# Install core packages
pnpm add @my-react/react @my-react/react-dompnpm add -D @my-react/react-refresh @my-react/react-refresh-tools// next.config.js
const withNext = require("@my-react/react-refresh-tools/withNext");
module.exports = withNext(nextConfig);pnpm add -D @my-react/react-refresh @my-react/react-vite// vite.config.ts
import react from "@my-react/react-vite";
export default defineConfig({
plugins: [
react({
// remix: true, // Enable Remix framework support
// router: true, // Enable React Router v7+ support
}),
],
});MyReact is one of the first React-like frameworks to ship an end-to-end RSC pipeline in a non-React runtime. The integration includes:
- Flight stream serialization/deserialization powered by
@lazarv/rsc - Server Actions (
"use server") and client components ("use client") - Unified SSR + RSC flow (server renders HTML from the Flight stream)
- Vite dev server integration for RSC endpoints and SSR HTML
- Server renders Flight stream with
renderToFlightStream. - SSR decodes the Flight stream with
createFlightServer().createFromStream(...). - HTML is rendered from the decoded tree.
- The same Flight stream is injected into HTML for hydration.
- Client hydrates using
createFlightClient()and the injected stream.
ui/rsc-example/src/entry-rsc.tsx # Flight stream
ui/rsc-example/src/entry-ssr.tsx # SSR HTML from Flight
ui/rsc-example/src/entry-client.tsx # Hydration
pnpm add -D @my-react/react-vite
pnpm add @my-react/react-server// vite.config.ts
import react from "@my-react/react-vite";
export default defineConfig({
plugins: [
react({
rsc: true,
rscEndpoint: "/__rsc",
rscActionEndpoint: "/__rsc_action",
ssr: {
entryRsc: "/src/entry-rsc.tsx",
entrySsr: "/src/entry-ssr.tsx",
},
}),
],
});RSC example (SSR + RSC + hydration): ui/rsc-example
pnpm add -D @my-react/react-refresh @my-react/react-rspack// rspack.config.ts
import { rspack } from "@rspack/core";
import RspackPlugin from "@my-react/react-rspack";
const config = {
...config,
plugins: [...config.plugins, new RspackPlugin()],
};MyReact supports Lynx for building cross-platform native applications with a dual-thread architecture.
pnpm add @my-react/react-lynx// lynx.config.ts
import { defineConfig } from "@lynx-js/rspeedy";
import { pluginMyReactLynx } from "@my-react/react-lynx/plugin";
export default defineConfig({
plugins: [pluginMyReactLynx()],
});// src/index.tsx
import { root, useInitData, InitDataProvider } from "@my-react/react-lynx";
function App() {
const initData = useInitData();
return <view>{initData.message}</view>;
}
root.render(
<InitDataProvider>
<App />
</InitDataProvider>
);| API | Description |
|---|---|
root.render() |
Render to Lynx page root |
useInitData() |
Get initData with auto re-render |
useGlobalProps() |
Get globalProps with auto re-render |
useLynxGlobalEventListener() |
Early event listener registration |
useMainThreadRef() |
Create main-thread accessible ref |
runOnMainThread() |
Execute code on main thread |
runOnBackground() |
Execute code on background thread |
InitDataProvider |
Provider for initData context |
GlobalPropsProvider |
Provider for globalProps context |
|
Next.js Demo
Full-featured SSR application |
Vite
Fast development setup |
RSC
Server Components example |
Lynx
Cross-platform native app |
| Package | Version | Description |
|---|---|---|
@my-react/react |
Core library with hooks and components | |
@my-react/react-dom |
DOM renderer with SSR support | |
@my-react/react-lynx |
- | Lynx renderer for cross-platform apps |
@my-react/react-terminal |
Terminal UI renderer | |
@my-react/react-three-fiber |
Three.js renderer |
| Package | Version | Description |
|---|---|---|
@my-react/react-refresh |
Fast refresh runtime | |
@my-react/react-refresh-tools |
Webpack & Next.js plugin | |
@my-react/react-vite |
Vite plugin | |
@my-react/react-rspack |
Rspack plugin |
| Package | Version | Description |
|---|---|---|
@my-react/react-jsx |
JSX runtime | |
@my-react/react-shared |
Shared utilities | |
@my-react/react-reconciler |
Full-featured reconciler | |
@my-react/react-reconciler-compact |
Compact reconciler |
| Package | Version | Description |
|---|---|---|
@my-react/react-reactive |
Reactive programming model |
# Clone the repository
git clone https://github.com/MrWangJustToDo/MyReact.git
cd MyReact
# Install dependencies
pnpm install
# Generate GraphQL types (if needed)
pnpm gen:gql
# Build all packages
pnpm build# Start development servers
pnpm dev:ssr # SSR example
pnpm dev:csr # CSR example
pnpm dev:next # Next.js example
pnpm dev:vite # Vite example
pnpm dev:remix # Remix example
pnpm dev:rspack # Rspack example
pnpm dev:lynx # Lynx example
# Other commands
pnpm dev # Watch mode for packages
pnpm test # Run tests
pnpm lint # Lint code|
@my-react/react
|
@my-react/react-dom
|
Hooks
|
@my-react/react-reactive
|
@my-react/react-lynx
|
@my-react/react-server/server
renderToFlightStream(element)createFlightServer({ moduleLoader, resolveModuleId })registerClientReference(...)registerServerReference(...)
@my-react/react-server/client
createFlightClient({ moduleLoader, actionEndpoint })createServerActionReference(actionId, callServer?)
⭐ = React 18+ features
MyReact comes with custom developer tools for debugging and inspecting your applications.
- Component tree inspection
- Props and state debugging
- Performance profiling
- Hook debugging
- Light and dark theme support
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
MIT © MrWangJustToDo

