choo-redirect

    2.0.0 • Public • Published

    choo-redirect stability

    npm version build status test coverage downloads js-standard-style

    Redirect a view to another view.

    Usage

    var redirect = require('choo-redirect')
    var html = require('choo/html')
    var choo = require('choo')
     
    var app = choo()
     
    app.route('/', redirect('/welcome'))
    app.route('/welcome', welcomeView)
     
    app.mount('body')
     
    function welcomeView () {
      return html`
        <body>
          <div>welcome!</div>
        </body>
      `
    }

    API

    view = redirect(route, rootSelector?)

    Create a new view that redirects to a route. Can take an optional second argument for the root selector which is used as the entry point of the application. Defaults to document.body.

    Installation

    $ npm install choo-redirect

    License

    MIT

    Install

    npm i choo-redirect

    DownloadsWeekly Downloads

    1

    Version

    2.0.0

    License

    MIT

    Last publish

    Collaborators

    • mafintosh
    • benlyn
    • s3ththompson
    • substack
    • yoshuawuyts
    • bret
    • lrlna
    • yerkopalma
    • juliangruber
    • timwis
    • ahdinosaur
    • toddself
    • sethvincent
    • maxogden
    • shama
    • freeman-lab
    • feross
    • emilbayes
    • colingourlay
    • jameskyburz
    • almost
    • slaskis
    • ungoldman
    • graforlock
    • tornqvist
    • amongiants
    • goto-bus-stop