Skip to content

Commit

Permalink
[fixed] sibling array route configs
Browse files Browse the repository at this point in the history
now you can configure your routes like this:

```js
var extraRoutes = [<Route/>, <Route/>];
var routes = (
  <Routes>
    <Route/>
    {extraRoutes}
    <Route/>
  </Routes>
);
```

closes remix-run#193
  • Loading branch information
abergs authored and ryanflorence committed Aug 14, 2014
1 parent 9a50faf commit 6d1ae95
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion modules/components/Routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,21 @@ function Redirect(to, params, query) {
this.query = query;
}

function findMatches(path, route) {
function findMatches(path,route){
var matches = null;

if (Array.isArray(route)) {
for (var i = 0, len = route.length; matches == null && i < len; ++i) {
matches = findMatches(path, route[i]);
}
} else {
matches = findMatchesForRoute(path,route);
}

return matches;
}

function findMatchesForRoute(path, route) {
var children = route.props.children, matches;
var params;

Expand Down

0 comments on commit 6d1ae95

Please sign in to comment.