Skip to content

Commit 6d1ae95

Browse files
abergsryanflorence
authored andcommitted
[fixed] sibling array route configs
now you can configure your routes like this: ```js var extraRoutes = [<Route/>, <Route/>]; var routes = ( <Routes> <Route/> {extraRoutes} <Route/> </Routes> ); ``` closes #193
1 parent 9a50faf commit 6d1ae95

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

modules/components/Routes.js

+15-1
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,21 @@ function Redirect(to, params, query) {
242242
this.query = query;
243243
}
244244

245-
function findMatches(path, route) {
245+
function findMatches(path,route){
246+
var matches = null;
247+
248+
if (Array.isArray(route)) {
249+
for (var i = 0, len = route.length; matches == null && i < len; ++i) {
250+
matches = findMatches(path, route[i]);
251+
}
252+
} else {
253+
matches = findMatchesForRoute(path,route);
254+
}
255+
256+
return matches;
257+
}
258+
259+
function findMatchesForRoute(path, route) {
246260
var children = route.props.children, matches;
247261
var params;
248262

0 commit comments

Comments
 (0)