0.1.0 • Published 1 year ago

unova v0.1.0

Weekly downloads
-
License
-
Repository
-
Last release
1 year ago

The Smallest JS framework 'React Like' (1kb), with support to Fibers, Concurrent Mode, O(n) algorithm, 3x faster than React.

size

Motivation

Why not build the smallest existing framework with React/Styled components compatible api? This question culminated in the creation of this framework.

Bundle size used to be more important, I agree, but even today, a large part of the world's population uses input devices, and has a poor mobile connection. One of the most popular stacks for website creation is React + Styled Components, however, including just these two libraries in your project will add considerable size to your Bundle. This library allows you to code with your favorite syntax, but without adding extra size to your website,

Attributes

  • Use Fibers
  • Support Concurrent Mode
  • O(n) algorithm, performance linear with 10 or 1000000000 of elements
  • Is really fast, 3x faster than React to adding items (see benchmark)
  • A really nice Schedule, with a fast first frame.
  • You can use with Vite using this plugin
import { jsx, useState } from "unova"

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

  return (
    <div>
      <button onClick={() => setCount(count + 1)}>+</button>
      <button onClick={() => setCount(count - 1)}>-</button>
      <p>Count: {count}</p>
    </div>
  );
};

render(<Counter />, document.getElementById("root"));

Do you want style it?

import { jsx, useState } from "unova"

const Button = styled.button`
  font-size: 1.5rem;
  padding: 0.5rem;
  margin: 0.5rem;
  border-radius: 5px;
  border: none;
  background-color: palevioletred;
  color: white;
`;

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

  return (
    <div>
      <Button onClick={() => setCount(count + 1)}>+</Button>
      <Button onClick={() => setCount(count - 1)}>-</Button>
      <p>Count: {count}</p>
    </div>
  );
};

Hooks

Vite plugin

If you are using vite, you do not need to add the import import { jsx, useState } from "unova" just add to your dependencies, the package unova-plugin-vite with npm install unova-plugin-vite --dev or yarn add unova-plugin-vite --dev

Using typescript

This library was written in TS. To work with tsx files, you need add this configuration to your tsconfig.json (if not present):

    "jsx": "react-jsx",
    "jsxImportSource": "unova"
0.1.0

1 year ago

0.0.1

1 year ago