question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error when trying the tutorial: sheet-router: tree must be an array

See original GitHub issue

Expected behavior

App expected to run in the browser. Other files run without problems.

Actual behavior

When trying to run with index.js as described in https://yoshuawuyts.gitbooks.io/choo/content/02_your_first_app.html getting the error in browser console:

assert.js:59 Uncaught AssertionError: sheet-router: tree must be an array

Steps to reproduce behavior

Following the exact instructions in https://yoshuawuyts.gitbooks.io/choo/content/02_your_first_app.html

Reduced to the simplest form:

const choo = require('choo')
const html = require('choo/html')
const app = choo()

app.model({
  state: {}
})

const view = (state, prev, send) => {
  return html``
}

app.router((route) => [
  route('/', view)
])

const tree = app.start()
document.body.appendChild(tree)

Still getting the error in the console

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
dmitrizcommented, Dec 18, 2016

I was able to fix the problem by changing the router declaration to

app.router(
  ['/', view]
)

Perhaps the router expects an array rather than function?

0reactions
timwiscommented, Dec 20, 2016

Fixed thx!

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Fix: ValueError: setting an array element with a ...
In this article, we will discuss how to fix ValueError: setting array element with a sequence using Python. Error which we basically ...
Read more >
Error: The argument should be an array of numbers of length 3
I have encountered an error of 'the argument should be an array of numbers of length 3' when I am trying to pilot...
Read more >
R Error in rowSums & colSums - must be array of at least two ...
In this tutorial, I'll show how to handle the “error in rowSums & colSums – 'x' must be an array of at least...
Read more >
Compiler Error CS0838 - Microsoft Learn
Multidimensional arrays in expression trees cannot be initialized by using an array initializer. To correct this error. Create and initialize ...
Read more >
Error while trying to predict numbers: Expected 2D array, got ...
ValueError: Expected 2D array, got 1D array instead. I know it's almost impossible to predict in this case, but my main goal here...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found