https://github.com/threepointone/react-router-modules
react-modules + react-router + 🌈
https://github.com/threepointone/react-router-modules
Last synced: about 1 month ago
JSON representation
react-modules + react-router + 🌈
- Host: GitHub
- URL: https://github.com/threepointone/react-router-modules
- Owner: threepointone
- Created: 2017-02-08T21:39:33.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-02-10T10:46:36.000Z (over 8 years ago)
- Last Synced: 2025-03-25T09:11:12.267Z (about 2 months ago)
- Language: JavaScript
- Size: 55.7 KB
- Stars: 12
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
react-router-modules
---[work in progress]
to prpl and beyond
usage
---`npm install @threepointone/react-router-modules`
add `@threepointone/react-router-modules/babel` to your babel plugins
the big idea
---we make a single change to the `` api
```diff
- import User from './user.js'```
- no new imports/apis, everything works as usual
- renders default export by default
- handles code splitting, SSR, behind the scenes
- works with `render`, `children` props as expected```jsx
Module ?
:
loading... )}
/>
// or use children-func, to render even when path doesn't match```
- todo - preserve server side rendered html while module asyncly loads
```jsx
// this will render SSR, but split code out and load separately
// server side rendered html will stay till module loads(!)
```- todo - statically extract mapping of url -> modules
```jsx
matchModule('/user/213', { Module } => {
// and then fetch data, render , whatever you like
})// you can now expose this via an api endpoint. and handle data fetching, etc
// this can also get treeshaked out lol
```- use in tandem with your server for PRPL
```jsx
// TODO
```constraints -
- For SSR to work, `path` has to be a static stringtodo -
- auto endpoints for data fetching
- prefetch links
- ``
- service workers
- all that jazz