@modern-js/main-doc 2.17.2-alpha.0 → 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,11 +375,11 @@ 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-motivation'
378
+ import Motivation from '@site-docs-en/components/convention-routing-movitation'
379
379
 
380
380
  <Motivation/>
381
381
 
382
- import Practice from '@site-docs/components/routes-practice'
382
+ import Practice from '@site-docs-en/components/routes-practice'
383
383
 
384
384
  <Practice/>
385
385
 
@@ -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
 
@@ -473,7 +473,7 @@ export const init = (context: RuntimeContext) => {
473
473
  - 使用 `render`,仅在空闲时对静态资源进行加载,不会与首屏静态资源抢占网络。
474
474
  - 在 SSR 场景下,也会对数据进行预取。
475
475
 
476
- import Motivation from '@site-docs/components/convention-routing-motivation'
476
+ import Motivation from '@site-docs/components/convention-routing-movitation'
477
477
 
478
478
  <Motivation/>
479
479
 
package/package.json CHANGED
@@ -15,7 +15,7 @@
15
15
  "modern",
16
16
  "modern.js"
17
17
  ],
18
- "version": "2.17.2-alpha.0",
18
+ "version": "2.17.2-alpha.3",
19
19
  "publishConfig": {
20
20
  "registry": "https://registry.npmjs.org/",
21
21
  "access": "public"
@@ -33,8 +33,8 @@
33
33
  "fs-extra": "^10",
34
34
  "@types/node": "^16",
35
35
  "@types/fs-extra": "^9",
36
- "@modern-js/doc-tools": "2.17.1",
37
36
  "@modern-js/builder-doc": "2.17.1",
37
+ "@modern-js/doc-tools": "2.17.1",
38
38
  "@modern-js/doc-plugin-auto-sidebar": "2.17.1"
39
39
  },
40
40
  "scripts": {