⚠️ Please note this is a very early stage demonstration of compatibility with the React 18. ⚠️

Limitations exist, please proceed with caution. Not everything will work out of the box, as this project is just a proof of concept.

Million/React compatibility demo

The purpose of this project is to utilize Million’s Virtual DOM and allow users to spin up a project that allows them to write basic React code and see it rendered.

Refer to the Million documentation to understand the internals and the React beta documentation to reference the API

Setup

The easiest way to use Million is it open it in Stackblitz:

Open in StackBlitz

If you want to use it locally, you can either fork the project, or clone it directly.

Here is how you clone it directly:

git clone https://github.com/aidenybai/million-react-compat
cd million-react-compat
npm install
npm run dev

Once you’ve done that, open script.jsx and start tinkering!

Usage

This is a Vite project. There are two ways to run it:

  • npm dev: runs the project in development mode.
  • npm build: bundles the project for production.

Available Hooks

  • useState
  • useEffect
  • useContext
  • useReducer
  • useCallback
  • useMemo
  • useRef
  • useLayoutEffect

Limitations

This list is nonexhaustive.

  • Fragments
  • Class components
  • Portals
  • Suspense
  • SSR
  • forwardRef
  • memo
  • Children API
  • and more…

GitHub

View Github