A Minimal Self-rendering Virtual DOM Library for React

A Minimal Self-rendering Virtual DOM Library for React

Noact is a minimal self-rendering Virtual DOM library. Declarative: Pretty much like React, without the JSX compilation of course, hence the name.

ReNoact

Noact is a minimal self-rendering Virtual DOM library.

  • Declarative: Pretty much like React, without the JSX compilation of course, hence the name.
  • Type safe: Noact is completely typesafe, which means you get static type checking for free!
  • Simple: Only 60 lines of type declarations & rendering code. (and 10ish lines of code-gen code)

Example App

How it feels to write Noact

demo.gif

- Explosions -

Even has support for style auto complete

typedemo.png

Usage

Noact is inspired by the syntax of the elm HTML engine

import { button, div } from "./NoactElements"
const component1 = div({},
    button({ onclick: () => alert(":D"), txt: "+" }),
    div({ txt: "♥" }),
    button({ onclick: () => alert("D:"), txt: "-" })
)

component1 is a memoized () => HTMLElement function, component1() will give you back

<div>
  <button>+</button>
  <div>♥</div>
  <button>-</button>
</div>

You can use component1 as it is, or compose it in a Virtual DOM configuration

import { createMountPoint } from "./Noact"
const mount = createMountPoint(document.querySelector(`#root`))
const remount = () => mount(
    component1,
    span({ txt: new Date().toString() })
)
setInterval(remount, 1000)

Here the root element will be populated with both component1 and span. Every 1000ms, #root > span and only #root > span will be updated.

In essence, component1 is both the rendering function, and the virtual DOM.

Download Details:

Author: ms-jpq

Demo: https://ms-jpq.github.io/noact-page/

Source Code: https://github.com/ms-jpq/noact

react reactjs javascript

Bootstrap 5 Complete Course with Examples

Bootstrap 5 Tutorial - Bootstrap 5 Crash Course for Beginners

Nest.JS Tutorial for Beginners

Hello Vue 3: A First Look at Vue 3 and the Composition API

Building a simple Applications with Vue 3

Deno Crash Course: Explore Deno and Create a full REST API with Deno

How to Build a Real-time Chat App with Deno and WebSockets

Convert HTML to Markdown Online

HTML entity encoder decoder Online

How native is React Native? | React Native vs Native App Development

Article covers: How native is react native?, React Native vs (Ionic, Cordova), Similarities and difference between React Native and Native App Development.

Increase Performance of React Applications Via Array JavaScript Methods

Increase Performance of React Applications Via Array JavaScript Methods. We will create a simple event management application in the react to add, update, and delete an event.

Routing in React without React-Router

I have been using React JS in my projects for quite some time now and am used to managing routing in my app using the react-router package. I have always been keen on having as little dependencies in my apps as possible, so, I always felt perturbed by the use of this particular package in simpler apps which did not have complex routes.

The Ugly Side of React Hooks

In this post, I will share my own point of view about React Hooks, and as the title of this post implies, I am not a big fan.

ReactJS: The Javascript Developer’s Guide

This article will walk you through the concepts you would need to know to step into the world of widely used ReactJS.