Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

deku

Package Overview
Dependencies
Maintainers
1
Versions
87
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

deku

Create view components using a virtual DOM

  • 0.0.4
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
538
increased by16.96%
Maintainers
1
Weekly downloads
 
Created
Source

Deku

Build Status

This project is still a work-in-progress

Create composable, reactive views that use implement a virtual DOM system similar to React.

The benefits of using Deku over React:

  • Smaller at roughly 5kb
  • Readable source
  • No globals or global state
  • Easily testable components without needing Jest
  • Isolated components that don't need a global to be mounted
  • It doesn't create virtual events
  • It only supports evergreen browsers
  • Easily add plugins
  • Events instead of mixins
  • Render methods can be imported instead of inline reducing the need for JSX

It has similar capabilities to React:

  • Components return a virtual tree using a render method
  • Batched rendering using requestAnimationFrame
  • Optimized tree diffs
  • Server-side rendering

Install

npm install deku

Example

var component = require('deku');

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

// Our main app.
var App = component({
  render(dom, state, props) {
    return dom('div', { class: 'App' }, [
      ButtonComponent({ text: props.buttonText })
    ]);
  }
});

// Returns a scene.
var scene = App.mount(document.body, {
  buttonText: 'Click Me!'
});

// We set the props from the top and render the scene top-down
scene.setProps({
  buttonText: 'Do it...'
});

FAQs

Package last updated on 13 Jan 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc