Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/rkrupinski/react

An experimental, lightweight React alternative.
https://github.com/rkrupinski/react

library react typescript ui yet-another

Last synced: about 1 month ago
JSON representation

An experimental, lightweight React alternative.

Awesome Lists containing this project

README

        

# @rkrupinski/react

An experimental, lightweight [React](https://react.dev/) alternative.

![Build status](https://github.com/rkrupinski/react/workflows/CI/badge.svg)
[![minified + gzip](https://badgen.net/bundlephobia/minzip/@rkrupinski/react)](https://bundlephobia.com/package/@rkrupinski/react)

Table of contents:

- [Getting started](#getting-started)
- [Example](#example)
- [API](#api)
- [JSX](#jsx)
- [Top-level API](#top-level-api)
- [Hooks](#hooks)

## Getting started

Install:

```
yarn add @rkrupinski/react
```

Make sure to set:

```json
{
"jsx": "react"
}
```

in your `tsconfig.json` -> `"compilerOptions"`.

Now you're all set:

```tsx
/* @jsx createElement */
/* @jsxFrag Fragment */

import {
render,
useState,
useEffect,
createElement,
Fragment,
type FC,
} from "@rkrupinski/react";

const App: FC = () => {
const [clicked, setClicked] = useState(0);

useEffect(() => {
console.log(`Clicked ${clicked} times`);
}, [clicked]);

return (
<>

Hello!


{
setClicked((c) => c + 1);
}}
>
{clicked}

>
);
};

const root = document.querySelector("#root") as HTMLElement;

render(, root);
```

## Example

- [Live](https://remarkable-rugelach-93aab7.netlify.app/)
- [Source code](https://github.com/rkrupinski/react/tree/master/packages/example)

## API

Read about [React](https://react.dev/reference) first, then come back here 🙏.

### JSX



Name
React
Caveats




createElement

createElement



  • Requires custom pragma (/* @jsx createElement */).

  • Limited to HTML elements (for the time being).

  • Weakly (any) typed host elements (for the time being).





Fragment

Fragment



  • Requires custom pragma (/* @jsxFrag Fragment */).




### Top-level API



Name
React
Caveats




render

render



  • No third argument (callback)

  • No concurrent mode

  • One root/app at a time (for the time being).





unmountAt

unmountComponentAtNode

-

### Hooks



Name
React
Caveats




useState

useState

-


useMemo

useMemo

-


useCallback

useCallback

-


useEffect

useEffect

-