Skip to content

Repository files navigation

@rkrupinski/react

An experimental, lightweight React alternative.

Build statusminified + gzip

Table of contents:

Getting started

Install:

yarn add @rkrupinski/react

Make sure to set:

{
"jsx": "react"
}

in your tsconfig.json -> "compilerOptions".

Now you're all set:

/* @jsx createElement *//* @jsxFrag Fragment */import{render,useState,useEffect,createElement,Fragment,typeFC,}from"@rkrupinski/react";constApp: FC=()=>{const[clicked,setClicked]=useState(0);useEffect(()=>{console.log(`Clicked ${clicked} times`);},[clicked]);return(<><h1>Hello!</h1><buttononClick={()=>{setClicked((c)=>c+1);}}>{clicked}</button></>);};constroot=document.querySelector("#root")asHTMLElement;render(<App/>,root);

Example

API

Read about React first, then come back here 🙏.

JSX

NameReactCaveats
createElementcreateElement
  • Requires custom pragma (/* @jsx createElement */).
  • Limited to HTML elements (for the time being).
  • Weakly (any) typed host elements (for the time being).
FragmentFragment
  • Requires custom pragma (/* @jsxFrag Fragment */).

Top-level API

NameReactCaveats
renderrender
  • No third argument (callback)
  • No concurrent mode
  • One root/app at a time (for the time being).
unmountAtunmountComponentAtNode-

Hooks

NameReactCaveats
useStateuseState-
useMemouseMemo-
useCallbackuseCallback-
useEffectuseEffect-

About

An experimental, lightweight React alternative.

Topics

Resources

Stars

4 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages