AlexGalays/abyssa-js

No magic in Router init

Closed this issue · 3 comments

It's a personal opinion, but I don't really like mixing classic stuff with magic stuff. In the Router initialization, it looks like if a key is named "notFound", it will catch all unknow urls to redirect to the corresponding state. Meaning all keys match only one url except this magic one.

I would rather create a new method on the Router. Moving from:

Router({
  home: State(),
  contact: State(),
  notFound: State()
})

to:

Router({
  home: State(),
  contact: State()
}).otherwise( State() )

That would be a good change if done.

Yes that's probably a good idea :)

Implemented in 67a49ea