@modern-js/main-doc 2.17.2-alpha.1 → 2.17.2-alpha.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -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
 
@@ -341,7 +341,7 @@ export default async (): Promise<ProfileData> => {
341
341
 
342
342
  ### 常见问题
343
343
 
344
- 1. loader 和 bff 的关系
344
+ 1. loader 和 bff 函数的关系
345
345
 
346
346
  在 CSR 项目中,loader 在客户端执行,在 loader 可以直接调用 bff 函数进行接口请求。
347
347
 
package/package.json CHANGED
@@ -15,7 +15,7 @@
15
15
  "modern",
16
16
  "modern.js"
17
17
  ],
18
- "version": "2.17.2-alpha.1",
18
+ "version": "2.17.2-alpha.3",
19
19
  "publishConfig": {
20
20
  "registry": "https://registry.npmjs.org/",
21
21
  "access": "public"