rent
v2.0.0
Published
Concisely test rendering functions with support for observable state
Downloads
4
Maintainers
Readme
rent
Concisely test rendering functions with support for observable state
Install
$ npm install --save rent
Usage
var rent = require('rent')
function renderFn (state) {
return state.name + ' is rendered'
}
var state = {
name: 'Ben'
}
var render = rent(renderFn, state)
var rendered = render()
//=> Ben is rendered
Or with observable state:
var rent = require('rent')
var Observ = require('observ')
function renderFn (state) {
return state.name + ' is rendered'
}
var state = Observ({
name: 'Ben'
})
var render = rent(renderFn, state)
var rendered = render()
//=> Ben is rendered
API
rent(renderFn, state)
-> function
renderFn
Required
Type: function
A render function that takes state and returns rendered content (like a string or a virtual DOM tree).
state
Required
Type: any
/ function
A state value or a function that can be called to get the current state.
License
MIT © Ben Drucker