📝 add an important detail for react's doc (#2178)
This commit is contained in:
parent
7d0116c322
commit
426b0dd674
|
|
@ -112,6 +112,7 @@ Take the `react 16` project generated by `create react app` as an example, with
|
||||||
ReactDOM.unmountComponentAtNode(container ? container.querySelector('#root') : document.querySelector('#root'));
|
ReactDOM.unmountComponentAtNode(container ? container.querySelector('#root') : document.querySelector('#root'));
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
It's important, When mount a sub-application through ReactDOM.render, need to ensure each sub-application load with a new router instance.
|
||||||
|
|
||||||
4. Modify `webpack` configuration
|
4. Modify `webpack` configuration
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -112,6 +112,7 @@ start();
|
||||||
ReactDOM.unmountComponentAtNode(container ? container.querySelector('#root') : document.querySelector('#root'));
|
ReactDOM.unmountComponentAtNode(container ? container.querySelector('#root') : document.querySelector('#root'));
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
这里需要特别注意的是,通过 ReactDOM.render 挂载子应用时,需要保证每次子应用加载都应使用一个新的路由实例。
|
||||||
|
|
||||||
4. 修改 `webpack` 配置
|
4. 修改 `webpack` 配置
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user