Skip to content
This repository has been archived by the owner on Mar 20, 2021. It is now read-only.
/ hypr Public archive

Build UI components with reactive state. Render with react, virtual-dom or mithril.

Notifications You must be signed in to change notification settings

idmitriev/hypr

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

97 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

hypr

Join the chat at https://gitter.im/idmitriev/hypr

NPM version Davis Dependency status experimental

Build UI components with reactive state. Render with react, virtual-dom or mithril.

Example

var
	hypr = require('hypr'),
	react = require('react'),
	virtualDom = require('virtual-dom'),
	mithril = require('mithril'),
	r = require('ramda');

function sum(a,b){
	return a+b;
}

var counterButton = hypr.component({
	name: 'counterButton',
	type: 'button',
	state: function(props, domEvents) {
		return {
			text: props.map(r.prop('text')),
			count: domEvents.filter(r.eq('inc')).map(1).scan(0, sum)
		}
	},
	props: {
		onClick: 'inc'
	},
	children: function(state){
		return [state.text, state.count].join(' ');
	}
})

window.onload = function(){
	hypr([react, virtualDom, mithril][Math.floor(Math.random()*3)])(
		counterButton({ text: 'like' }),
		document.body
	);
}

About

Build UI components with reactive state. Render with react, virtual-dom or mithril.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published