Niche Portobello Mushroom

    bacta

    0.5.7 • Public • Published

    bacta

    This is a very early draft at an opinionated layer on top of mithril that manages:

    • routing
    • state management
    • side effects
    • more!

    Please do not use this yet! Very early days!

    Example

    Live Example

    Quick Start

    import m from 'mithril'
    import * as B from 'bacta'
     
    const LoggedIn = B.maybe('LoggedIn')
     
    B.mount( document.body, {
      Route: {
        Home: ['/', () => import('./components/home.js')],
        Login: ['/login', () => import('./components/login.js')]
      },
      initial(){
        return {
          user: LoggedIn.N()
        }
      },
      render({ activeComponent, ...attrs }){
     
        const Loaded = activeComponent()
     
        return Loaded 
          ? m(Loaded, attrs )
          : m('h1', 'Loading')
      }
    })

    API

    attrs

    • setState
    • getState
    • link
    • subLink
    • route
    • moduleCache
    • Route
    • activeModule
    • activeComponent

    B.mount

    B.mount options

    • Route
    • initial
    • services
    • render
    • default
    • reducer
    • location
    • streamKey

    B.component

    B.types

    B.createRoute

    B.stream

    Install

    npm i bacta

    DownloadsWeekly Downloads

    12

    Version

    0.5.7

    License

    MIT

    Unpacked Size

    243 kB

    Total Files

    12

    Last publish

    Collaborators

    • jaforbes