Isomorphic alt with react-router and AltIso
- Dominant language
- JavaScript
- Stars
- 3.4k
- Forks
- 312
- PR merge metrics
- No merged PRs in 30d
Description
I'd love to see an isomorphic example combining react-router and AltIso (specifically, the recently added `@AltIso.define` component decorator). I find that I can't use `AltIso.render` on the client side because I have to call react-router's `Router.run`, so I end up replacing the `AltIso.render` call with something like:
``` js
import Iso from "iso";
import * as Render from "alt/utils/Render";
Iso.bootstrap(function (state, _, container) {
alt.bootstrap(state);
Router.run(routes, Router.HistoryLocation, (Handler) => {
Render.toDOM(Handler, {}, container);
});
});
```
It's very much like the client-side portion of AltIso.js, but allows for calling `Router.run` where necessary.
However, when I do that, I find that only my server side rendering works, and the client side route changes don't fire. Yet, if I omit usage of the `@AltIso.define` decorator in the relevant components, the client side route changes happen fine. So, there's some interaction going on there that's not emitting any warnings or errors.
I'm happy to pack up my example and submit a PR with it once I can get the remaining issues worked out.
Thoughts?
Thanks so much for these great tools!
Contributor guide
Assessment
This issue has not been assessed yet.