preactjs/preact-router

Sorting routes by rank

Open

#63 opened on Aug 17, 2016

View on GitHub
 (1 comment) (0 reactions) (0 assignees)JavaScript (152 forks)github user discovery
enhancementhelp wanted

Repository metrics

Stars
 (1,055 stars)
PR merge metrics
 (PR metrics pending)

Description

<Router> component now sorts routes by count of path segments or by path string length as a fallback.

Maybe it would helpful allow programmers to specify rank explicitly?

This can be done with new rank attribute for route component. Or with using key attribute as rank. Or with preserving order of <Router> component children when counts of path segments are equal (stable sort).

Contributor guide