choojs / choojs/choo

Docs: Code to listen for 'navigation' change does not output written behavior

Open
#627 5 comments 1 reaction 0 assignees View on GitHub
Dominant language
JavaScript
Stars
6.8k
Forks
573
PR merge metrics
No merged PRs in 30d

Description

### Expected behavior
In the Choo docs on Routing, in the section "Listening for Route Changes" implementing:

```
var html = require('choo/html')
var choo = require('choo')
var app = choo()

var app = choo()
app.use((state, emitter) => { // 1.
emitter.on('navigate', (route) => { // 2.
console.log(`Navigated to ${route}`) // 3.
})
})
```

Should return a console message "Navigated to [insert route here]

### Actual behavior
This code snippet instead returns a console message "Navigated to undefined"

### Steps to reproduce behavior

1. Add in code as written in the docs (and reproduced above)
2. Click through / navigate between two separate routes.
3. Observe the console message.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.