Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 1,000,000+ packages pre-installed, including bik with all npm packages installed. Try it out:

var bik = require("bik")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

bik v2.0.1

Simple functional components for non-choo & choo environments


Simple functional components for non-choo & choo environments. Provides a state around morfine.


npm i bik


var component = require('bik')
var html = require('nanohtml')

var counter = component({ count: 0 }, function (ctx, amount) {
  return html`
    <div onclick="${click}">Count is ${ctx.count}</div>

  function click () {
    ctx.count += amount

// non-choo

// choo

It also works standalone in the browser by including build/bik.min.js. It provides a global bik function.


To write simple components and be able to use them outside of Choo.

Bik's philosophy:

  • Support both choo and non-choo environments
  • Direct access to the whole context (state + component)
  • No events, only functions


render(...props) = bik(initialState, renderer(context, ...props))

Initialize a new bik instance. initialState is an object. The renderer function gets the whole context (state + component) as an argument, followed by the arguments of the render call.


Called when the element was mounted via on-load.


Called when the element was unmounted via on-load.

component.rerender() or component.r()

Rerenders the component.


Called after the new tree has been generated, but not yet rendered.


Called after the new tree was rendered.


The current DOM Node in the document.

See Also

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free