Skip to content

Commit 323e827

Browse files
authored
docs: optimize quick start content (#2318)
1 parent 2f697b9 commit 323e827

File tree

2 files changed

+25
-4
lines changed

2 files changed

+25
-4
lines changed

apps/website-new/docs/en/guide/start/quick-start.mdx

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,27 @@ bun add @module-federation/enhanced
5656

5757
### 3. Exporting Modules by the Producer
5858

59+
> Change the entry file to asynchronous
60+
61+
62+
```tsx
63+
// Move src/index.tsx to a newly created src/bootstrap.tsx file
64+
// src/index.tsx
65+
import('./bootstrap');
66+
67+
// src/bootstrap.tsx
68+
import React from 'react';
69+
import ReactDOM from 'react-dom/client';
70+
import App from './App';
71+
72+
const root = ReactDOM.createRoot(document.getElementById('root')!);
73+
root.render(
74+
<React.StrictMode>
75+
<App />
76+
</React.StrictMode>,
77+
);
78+
```
79+
5980
> Add a Button Component
6081
6182
```tsx
@@ -204,7 +225,7 @@ root.render(
204225
```json
205226
{
206227
"compilerOptions": {
207-
"path":{
228+
"paths":{
208229
"*": ["./@mf-types/*"]
209230
}
210231
}
@@ -254,7 +275,7 @@ import React from 'react';
254275
import ReactDOM from 'react-dom/client';
255276
import App from './App';
256277

257-
const root = ReactDOM.createRoot(document.getElementById('root'));
278+
const root = ReactDOM.createRoot(document.getElementById('root')!);
258279
root.render(
259280
<React.StrictMode>
260281
<App />

apps/website-new/docs/zh/guide/start/quick-start.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ import React from 'react';
6666
import ReactDOM from 'react-dom/client';
6767
import App from './App';
6868

69-
const root = ReactDOM.createRoot(document.getElementById('root'));
69+
const root = ReactDOM.createRoot(document.getElementById('root')!);
7070
root.render(
7171
<React.StrictMode>
7272
<App />
@@ -237,7 +237,7 @@ import React from 'react';
237237
import ReactDOM from 'react-dom/client';
238238
import App from './App';
239239

240-
const root = ReactDOM.createRoot(document.getElementById('root'));
240+
const root = ReactDOM.createRoot(document.getElementById('root')!);
241241
root.render(
242242
<React.StrictMode>
243243
<App />

0 commit comments

Comments
 (0)