Giter VIP home page Giter VIP logo

deku's Introduction

Deku

A simple library for creating UI components using virtual DOM.

version Dependency Status Circle CI npm

  • It's small at roughly 8kb.
  • Supports npm, duo, and bower.
  • Easily add plugins to any component.
  • It only supports IE10+ and better browsers.
  • Server-side rendering.
  • Easily test components.
  • Handles all event delegation for you without virtual events.
  • Batched and optimized updates using requestAnimationFrame.

Example

var {component,dom} = require('deku');

var Button = component({
  onClick() {
    this.setState({ clicked: true });
  },
  render(props, state) {
    return dom('button', { onClick: this.onClick }, [props.text]);
  }
});

var scene = Button.render(document.body, {
  text: 'Click Me!'
});

Getting Started

Download

Browserify/Node:

npm install deku

Duo:

var deku = require('segmentio/deku');

Bower:

bower install deku

Or download and use them manually:

Browser Support

Sauce Test Status

JSX Support

There are a number of libraries around now that can transpile JSX into JS that aren't tied to React. The easiest way to use JSX with Deku is to use Babel (formerly known as 6to5).

Babel comes with a JSX transformer that can be used by adding a comment to the top of your file:

/** @jsx dom */
var {component,dom} = require('deku');

var Button = component({
  render(props, state) {
    return <a class="button" onClick={this.onClick}>{props.text}</a>;
  }
});

You can also use jsx-transform if you're looking for something simple.

Developing

Deku is built using Browserify and Make. You can build the project by running make in the directory.

To run the tests you can call make test to run tests in Phantom or make test-browser to run the tests in a browser. See the Makefile for the rest of the tasks.

Authors

deku's People

Contributors

anthonyshort avatar kazupon avatar lancejpollard avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.