首页 > 解决方案 > 将 ReactJS 拆分为多个程序集

问题描述

ve 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 it将组件放入多个程序集中并在运行时加载它们?

标签: javascriptc#asp.netreactjsasp.net-core

解决方案


是的,它确实。

我建议你阅读 React官方文档

几乎每个 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>
    }
}

推荐阅读