Redirect a view to another view.
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>
`
}
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
.
$ npm install choo-redirect