/vite-pozitron-starter

vite pozitron starter template

Primary LanguageJavaScriptMIT LicenseMIT

Vite Pozitron starter App

vite starter template Pozitron + JSX

StackBlitz demo

CodeSandbox demo

not production ready!

Features required to implement:

  • cyclic references detection (!)
  • reactive stores
  • class and other properties special handling
  • lists/For, if-s
  • destroying reactions (effects) with no dependencies, unmounts (removing event listeners)
  • events delegation

Pozitron is ultra-minimalistic reactive library

jsx support provided by vite-plugin-pozitron

install

$ cd project-path
$ git clone https://github.com/NesCafe62/vite-pozitron-starter .
$ npm install

start for development

$ npm start

build project. results saved to ./dist

$ npm run build

preview production build

$ npm run serve

jsx

import { signal } from 'pozitron-js';
import { render } from 'pozitron-js/render';

function Counter() {
    const [count, setCount] = signal(0);

	function increment() {
		setCount(count() + 1);
	}

	return (
		<button onClick={increment}>Count: {count}</button>
	);
}

render(Counter, document.getElementById('app'));

hyperscript

import { signal } from 'pozitron-js';
import { h, render } from 'pozitron-js/render';

function Counter() {
    const [count, setCount] = signal(0);

	function increment() {
		setCount(count() + 1);
	}

	return h('button', {on: {click: increment}}, ['Count: ', count]);
}

render(Counter, document.getElementById('app'));