You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -158,6 +158,8 @@ What you could load using `useImported`? Everything - `imported` itself is using
158
158
159
159
> `useImported` is an excellent example for loading translations, which are usually a simple json, in a _trackable_ way.
160
160
161
+
> 💡 did you know that there is another hook based solution to load _"something might might need"_? The [use-sidecar](https://github.com/theKashey/use-sidecar) pattern.
162
+
161
163
<aname="api"/>
162
164
163
165
# API
@@ -199,6 +201,8 @@ What you could load using `useImported`? Everything - `imported` itself is using
React-prerendered-component is another way to work with code splitting, which makes everything far better.
409
-
410
-
411
-
## CSS Support
412
-
### CSS-in-JS Support
413
-
First class. Literally CSS-in-JS library, like `styled-component` will do it by themselves, and there is nothing
414
-
to be managed by this library
415
-
416
-
### Static CSS Support
417
-
This library __does not__ support CSS as CSS, as long it's bundler independent. However, there is
418
-
a bundler independent way to support CSS:
419
-
1. Configure you bundler, and server side rendering to emit the right `classNames` (just remove `style-loader` from webpack configuration)
420
-
2. Use `used-styles` to inject used __css files__ to the resulting HTML.
421
-
422
-
In short (streamed example is NOT short)
423
-
```js
424
-
constmarkup=ReactDOM.renderToString(<App />)
425
-
constusedStyles=getUsedStyles(markup, lookup);
426
-
```
427
-
428
-
If you need _stream render_ example with __reduced TTFB__, or critical style extraction -
429
-
please refer to [used-styles](https://github.com/theKashey/used-styles) documentation, or our [parcel-bundler stream server example](https://github.com/theKashey/react-imported-component/tree/master/examples/SSR/parcel-react-ssr/stream-server).
430
-
431
-
> everything is possible
414
+
`React-prerendered-component` is another way to work with code splitting, which makes everything far better.
432
415
433
416
## Timeout to display "spinners"
434
417
There is no build in timeouts to display Error or Loading states. You could control everything by yourself
@@ -454,6 +437,40 @@ const MyPage = () => (
454
437
);
455
438
```
456
439
440
+
<aname="css"/>
441
+
442
+
## CSS Support
443
+
### CSS-in-JS Support
444
+
Out-of-the-box. Literally. CSS-in-JS library, like `styled-component` will do it by themselves, and there is nothing
445
+
to be managed by this library.
446
+
447
+
### Static CSS Files Support
448
+
> `imported` could knew only about JS you've used, not the CSS that js've used...
449
+
450
+
This library __does not__ support CSS as CSS, as long it's bundler independent and such deep integration is not possible.
451
+
Even if [deep bundler integration](#bundler) is next following this section - the recomended solution is to skip `css` part of it, and use
452
+
a more _bundler independent_ way to support CSS:
453
+
454
+
1. Configure you bundler, and server side rendering to emit the right `classNames` (just remove `style-loader` from webpack configuration)
455
+
2. Use `used-styles` to inject used __css files__ to the resulting HTML.
// extract critical CSS and inline in to the server response
467
+
```
468
+
469
+
If you need _stream render_ example with __reduced TTFB__ -
470
+
please refer to [used-styles](https://github.com/theKashey/used-styles) documentation, or our [parcel-bundler stream server example](https://github.com/theKashey/react-imported-component/tree/master/examples/SSR/parcel-react-ssr/stream-server).
471
+
472
+
<aname="bundler-integration"/>
473
+
457
474
## Bundler integration
458
475
Keep in mind - you dont "need" this. It will just make integration slightly better in terms of prefetching (which affects network recourse priority) and thus startup time.
459
476
@@ -571,7 +588,9 @@ Another loaders exists, and the only difference is in API, and how they manage (
571
588
* (webpack only) With [react-loadable](https://github.com/thejameskyle/react-loadable)
572
589
* (not compatible with hooks) [react-async-component](https://github.com/ctrlplusb/react-async-component)
0 commit comments