erikras / erikras/react-redux-universal-hot-example

SOLVED: Hard time getting dynamic routes to work

Open
#1,233 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
12.1k
Forks
2.5k
PR merge metrics
No merged PRs in 30d

Description

I've been on this for over a week with no success. Here is my status so far ...

```
exports.getRoutes =(store) => {
let dynRoutes = [];
store.dispatch(loadNav()).then(result => {
dynRoutes = result;
});
return (
/**
* Please keep routes in alphabetical order
*/

{ /* Home (main) route */ }

{ /* Get Dyanamic routes from database */ }
{ dynRoutes.length > 0 ?

: ''}
{ /* Catch all route */ }


)
}
```

While the callback does occur and dynRoutes does have a value, the return has already completed and the component DynamicRoutes is no longer called with the actual dynRoutes prop values.

Any ideas?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.