Skip to content

Commit 1fb5d18

Browse files
committed
improve documentation
1 parent 005db3a commit 1fb5d18

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

README.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,11 @@ Key features:
6767
- Loads chunks only after the `main one`, as long as loader code is bundled inside the main chunk, so it should be loaded first.
6868
- Not an issue with the `progressive hydration`, and might provide a better UX via feature detection.
6969
- Provides 👨‍🔬 technological workaround - [see here](#concurrent-loading)
70+
71+
👯‍♀️Works better in pair
72+
- [react-prerendered-component](https://github.com/theKashey/react-prerendered-component) for prerendering, partial hydration and react fragment caching
73+
- [used-style](https://github.com/theKashey/used-styles) for CSS and critical CSS extraction
74+
- [devolution](https://github.com/theKashey/devolution) for shipping legacy/modern bundles
7075

7176
<a name="usage"/>
7277

@@ -147,6 +152,8 @@ const MyCalendarComponent = () => {
147152
```
148153
What you could load using `useImported`? Everything - `imported` itself is using it to import components.
149154

155+
> `useImported` is an excellent example for loading translations, which are usually a simple json, in a _trackable_ way.
156+
150157
<a name="api"/>
151158

152159
# API
@@ -506,6 +513,25 @@ It does not matter how do you bundle your application - it could be even browser
506513
- You might even dont have any separated chunk on the server side - it would still works.
507514
- You might even ship module/nomodule scripts, using, for example, [devolution](https://github.com/theKashey/devolution) - no additional configuration would be required.
508515

516+
## Why you need SSR
517+
In case of imported component SSR is a "dry run" of your application - an easy way to discover required pieces
518+
powered by zero latency(you are already on the server) and super fast speed connection (all scripts are in memory).
519+
520+
However - you dont need SSR to get the same benefits on pure ClientSideRendered solutions - _prediction_ would be enought.
521+
The common approach is to
522+
- load first part of components, including Providers, which would load something they need. Like translations.
523+
- then hit, and load the current route
524+
- then do the same with the sub route
525+
526+
This causes effect known as `loading waves`, the effect SSR could mitigate almost in full.
527+
528+
However, nothing stops you from loading translation data in the parallel to the routes, and loading
529+
route and sub route in the same time, not sequentially.
530+
You can have backend-for-frontend, why not to have frontend-for-frontend?
531+
Just handle route, cookies, and whatever you could handle, outside of React. [Redux-first-router](https://github.com/faceyspacey/redux-first-router) and principles behind it
532+
are the great example of this idealogy.
533+
534+
509535
### Not using React.Lazy with React-Hot-Loader
510536
There is design limitation with React.lazy support from RHL size, so they could not be reloaded without
511537
state loss if `lazy` is created not in the user space. At it would be created inside imported.

0 commit comments

Comments
 (0)