diff --git a/index.js b/index.js index 7d27baf4..30d17cab 100644 --- a/index.js +++ b/index.js @@ -111,7 +111,7 @@ function choo (opts) { // create a new router with a custom `createRoute()` function // (str?, obj) -> null function createRouter (routerOpts, routes, createSend) { - var prev = {} + var prev = null if (!routes) { routes = routerOpts routerOpts = {} @@ -129,9 +129,11 @@ function choo (opts) { const nwPrev = prev prev = state + console.log('params', params) + // TODO(yw): find a way to wrap handlers so params shows up in state const nwState = xtend(state) - nwState.location = xtend(nwPrev.location, { params: params }) + nwState.location = xtend(nwState.location, { params: params }) if (opts.freeze !== false) Object.freeze(nwState) return handler(nwState, nwPrev, send)