All Projects → delacruz-dev → joltik

delacruz-dev / joltik

Licence: other
A really small VDOM library

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to joltik

Hyperawesome
A curated list of awesome projects built with Hyperapp & more.
Stars: ✭ 446 (+1015%)
Mutual labels:  jsx, vdom
Preact
⚛️ Fast 3kB React alternative with the same modern API. Components & Virtual DOM.
Stars: ✭ 30,527 (+76217.5%)
Mutual labels:  jsx, vdom
Vhtml
Render JSX/Hyperscript to HTML strings, without VDOM 🌈
Stars: ✭ 556 (+1290%)
Mutual labels:  jsx, vdom
zaftig
~2kB css in js: z`display flex` // .zjsdkk43-1
Stars: ✭ 15 (-62.5%)
Mutual labels:  jsx, vdom
Preact Render Spy
Render preact components with access to the produced virtual dom for testing.
Stars: ✭ 178 (+345%)
Mutual labels:  jsx, vdom
Nerv
A blazing fast React alternative, compatible with IE8 and React 16.
Stars: ✭ 5,409 (+13422.5%)
Mutual labels:  jsx, vdom
Muve
Muve is a micro library for building interactive javascript applications.
Stars: ✭ 11 (-72.5%)
Mutual labels:  jsx, vdom
Wonders
🌈 Declarative JavaScript framework to build command-line applications.
Stars: ✭ 34 (-15%)
Mutual labels:  jsx, vdom
Omi
Front End Cross-Frameworks Framework - 前端跨框架跨平台框架
Stars: ✭ 12,153 (+30282.5%)
Mutual labels:  jsx, vdom
Karet
Karet is a library that allows you to embed Kefir observables into React VDOM
Stars: ✭ 81 (+102.5%)
Mutual labels:  jsx, vdom
Ng Vdom
(Developer Preview) A virtual-DOM extension for Angular, also work as React bridge.
Stars: ✭ 249 (+522.5%)
Mutual labels:  jsx, vdom
Fre
👻 Tiny Footprint Concurrent UI library for Fiber.
Stars: ✭ 3,195 (+7887.5%)
Mutual labels:  jsx, vdom
Inferno
🔥 An extremely fast, React-like JavaScript library for building modern user interfaces
Stars: ✭ 15,206 (+37915%)
Mutual labels:  jsx, vdom
iwish
I wish that too!
Stars: ✭ 19 (-52.5%)
Mutual labels:  jsx
element
Fast and simple custom elements.
Stars: ✭ 65 (+62.5%)
Mutual labels:  jsx
ai-merge
Import your SVG, AI, EPS, and PDF files into a single Illustrator document.
Stars: ✭ 65 (+62.5%)
Mutual labels:  jsx
tung
A javascript library for rendering html
Stars: ✭ 29 (-27.5%)
Mutual labels:  jsx
trad
A JavaScript-like and C based language for building user interfaces.
Stars: ✭ 91 (+127.5%)
Mutual labels:  jsx
re-hyperapp
Almost zero-cost bindings for the https://github.com/hyperapp/hyperapp UI library.
Stars: ✭ 21 (-47.5%)
Mutual labels:  jsx
unplugin-icons
🤹 Access thousands of icons as components on-demand universally.
Stars: ✭ 2,064 (+5060%)
Mutual labels:  jsx

joltik

A micro VDOM library for learning purposes

Description

I'm just learning how a VDOM (Virtual Document Object Model) library works by building one and documenting my learnings in medium. I don't pretend this to be nothing serious, so please don't use it in production.

Installation

$ npm install joltik --save

Configuring JSX pragma

By default, [Babel] transforms your JSX code into a call to React.createElement. You can customize this behaviour by adding a jsx pragma at the top of your files, with the following syntax:

/** @jsx j */

Wher j here is joltik's replacement for React.createElement. You can read more about this behaviour in @developit's blog post: WTF Is JSX.

Configuring Babel

You will need to install Babel's transform react jsx plugin in order to support JSX syntax only, instead of the full preset you normally would use for React.

Here's a sample of the bare minimum .babelrc config you will need:

{
  "presets": ["env"],
  "plugins": ["transform-react-jsx"]
}

It is very convenient to replace your pragma everywhere by defoult, to avoid adding it as a comment at the top of your files. In order to do so, add the following config to the plugin:

{
    ...
    "plugins": [
        ["@babel/plugin-transform-react-jsx", {
            "pragma": "j"
        }]
    ]
}

Creating your first component

The syntax is similar to a usual React component, with the only difference of importing j from joltik.

// HelloWorld.js
import { j } from "joltik";
import "./styles.css";

export const HelloWorld = ({ text }) => <h1 className="title">{text}</h1>;

To render an element, you would do:

// index.js
import { j, createElement } from "joltik";
import { HelloWolrd } from "./HelloWorld";

document
  .getElementById("app")
  .appendChild(createElement(<Hello text="Hello, joltik!" />));

Demo

You can see a working demo in this codesandbox and also in the examples folder.

Why Joltik?

joltik

Joltik is the smallest Pokémon from all the current editions.

References

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].