remini icon indicating copy to clipboard operation
remini copied to clipboard

Mini React implementation made for fun and practice. Please do not use in production.

remini

Mini React implementation made for fun and practice. Please do not use in production.

Example

import { useState, createElement as c, render } from "./lib";

const Counter = () => {
  const [count, setCount] = useState(0);

  return c(
    "div",
    {},
    c("div", {}, `Value: ${count}`),
    c("button", { onClick: () => setCount(count + 1) })
  );
};

render(c(Counter), document.getElementById("root"));

How to play with it?

/examples contains examples of small web apps wrote with the library.

/packages/remini is the main library. It contains test that can be run with yarn test.

Packages

  • babel-plugin – contains Babel plugin for transforming files to support fast refresh and the runtime that is used for refreshing components.

  • remini – main library.

  • vite-plugin – plugin for Vite to support fast refresh.

Might come later

  • [x] Accepting style object as alternative to string prop
  • [x] Updater version of setState
  • [x] refs
  • [x] Context API
  • [x] <Fragment />
  • [x] SSR
  • [x] Fast refresh
  • [ ] key prop

Missing from React

  • Non-blocking rendering
  • Ref forwarding
  • Code splitting
  • Portals
  • Suspense
  • Server components

Useful reading

HMR

Actual implementations

Later

TODO

  • [ ] Fast refresh duplicates SVG nodes