【问题标题】:Splitting ReactJS onto multiple assemblies将 ReactJS 拆分为多个程序集
【发布时间】:2019-09-28 20:26:56
【问题描述】:
Ive got a modular .NET application, which loads controllers, views and components from assemblies as plugins.
Going to learn React (totally new to it) - and got a question. Does React support splitting its 组件到多个程序集中并在运行时加载它们?
【问题讨论】:
标签:
javascript
c#
asp.net
reactjs
asp.net-core
【解决方案1】:
是的,确实如此。
我建议你阅读 React official documentation。
几乎每个 React 组件都会生成一些 HTML 标记供浏览器显示。组件拆分的一般思路是像这样在几个组件之间拆分 HTML 标记
// App.js
class App extends React.Component {
render () {
return <div>
My first component
<Component1/>
</div>
}
}
// Component1.js
export default class Component1 extends React.Component {
render () {
return <div>
This is internals of component
</div>
}
}
【讨论】:
-
嗨@ww87 如果这个答案已经解决了你的问题,请点击复选标记考虑accepting it。这向更广泛的社区表明您已经找到了解决方案,并为回答者和您自己提供了一些声誉。没有义务这样做。