choo-shortcache

0.0.0 • Public • Published

choo-shortcache

shortcut access to state.cache() anywhere in your app

Example

app.use(require('choo-shortcache'))

Elsewhere in your app...

var { cache } = require('choo-shortcache')
var MyComponent = require('./mycomponent')
 
module.exports = function (state, emit) {
  return html`
    ${cache(MyComponent, 'MyComponent').render()}
  `
}

What is this for?

(nano)component instances are managed in choo using state.cache(). This pattern works well, but it requires you pass state everywhere, potentially very deep into your app, just to create components. This plugin allows you to create components at any depth level in your app without directly passing the entire state all the way down. Under the hood it just creates a reference to state.cache() that you can import with:

var { cache } = require('choo-shortcache')

Dependencies (0)

    Dev Dependencies (0)

      Package Sidebar

      Install

      npm i choo-shortcache

      Weekly Downloads

      1

      Version

      0.0.0

      License

      MIT

      Unpacked Size

      13.8 MB

      Total Files

      3894

      Last publish

      Collaborators

      • amongiants