@modern-js/main-doc 2.17.2-alpha.1 → 2.17.2-alpha.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -341,6 +341,14 @@ export default async (): Promise<ProfileData> => {
|
|
341
341
|
|
342
342
|
4. When run on the server side, the `loader` functions are packaged into a single bundle, so we do not recommend using `__filename` and `__dirname` for server-side code.
|
343
343
|
|
344
|
+
### FAQ
|
345
|
+
|
346
|
+
1. Relationship between loader and bff functions
|
347
|
+
|
348
|
+
In a CSR project, the loader is executed on the client side and the bff function can be called directly from the loader to make a request.
|
349
|
+
|
350
|
+
In an SSR project, each loader is also a server-side API, and we recommend using loader instead of the BFF function which http method is `get` to avoid one more layer of forwarding and execution.
|
351
|
+
|
344
352
|
## useLoader(Old)
|
345
353
|
|
346
354
|
**`useLoader`** is an API in Modern.js old version. The API is a React Hook specially provided for SSR applications, allowing developers to fetch data in components.
|
@@ -375,7 +375,7 @@ To further improve the user experience and reduce time of loading, Modern.js sup
|
|
375
375
|
- With `render`, static resources are loaded only when they are idle and do not hog the network with first-screen static resources.
|
376
376
|
- When using server side rendering, data is also prefetched.
|
377
377
|
|
378
|
-
import Motivation from '@site-docs/components/convention-routing-movitation'
|
378
|
+
import Motivation from '@site-docs-en/components/convention-routing-movitation'
|
379
379
|
|
380
380
|
<Motivation/>
|
381
381
|
|