@modern-js/main-doc 2.17.2-alpha.0 → 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.
- package/docs/en/guides/basic-features/data-fetch.mdx +8 -0
- package/docs/en/guides/basic-features/routes.mdx +2 -2
- package/docs/zh/guides/basic-features/data-fetch.mdx +1 -1
- package/docs/zh/guides/basic-features/routes.mdx +1 -1
- package/package.json +2 -2
- /package/docs/zh/components/{convention-routing-motivation.mdx → convention-routing-movitation.mdx} +0 -0
@@ -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-
|
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
|
|
@@ -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-
|
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.
|
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": {
|
/package/docs/zh/components/{convention-routing-motivation.mdx → convention-routing-movitation.mdx}
RENAMED
File without changes
|