小编R. *_*ait的帖子

React.js如何在组件内部渲染组件?

我被卡住了.我在单独的文件上有几个单独的组件.如果我在main.jsx中渲染它们如下:

ReactDOM.render(<LandingPageBox/>, document.getElementById("page-landing")); 
ReactDOM.render(<TopPlayerBox topPlayersData={topPlayersData}/>, document.getElementById("wrapper profile-data-wrapper"));
ReactDOM.render(<RecentGamesBox recentGamesData={recentGamesData}/>, document.getElementById("history wrapper"));
Run Code Online (Sandbox Code Playgroud)

一切正常,但我想知道这是一个好习惯吗?也许有可能做类似于只有一个ReactDom.render的事情:

ReactDOM.render(<LandingPageBox recentGamesData={recentGamesData} topPlayersData={topPlayersData}/>, document.getElementById("page-landing")); 
Run Code Online (Sandbox Code Playgroud)

我尝试了不同种类的LandingPageBox变种以某种方式包含其他两个组件,但没有运气.它们有时会在页面外呈现,依此类推.我认为应该看起来像这样:

import React from 'react';
import RecentGames from '../RecentGames/RecentGames.jsx';
import TopPlayers from '../TopPlayers/TopPlayers.jsx';
import PageTop from './PageTop.jsx';
import PageBottom from './PageBottom.jsx';

class LandingPageBox extends React.Component {
    render() {
        return (
            <body className="page-landing">
                <PageTop>
                     <TopPlayers topPlayersData={this.props.topPlayersData} />
                </PageTop>
                <PageBottom>
                        <RecentGames recentGamesData=    {this.props.recentGamesData}/>
                    </PageBottom>              
                </body>
            );
        }
    }

export default LandingPageBox;
Run Code Online (Sandbox Code Playgroud)

但是这段代码只渲染PageTop和PageBottom,没有播放器或游戏组件.

所以我的问题是,如何设置LandingPageBox文件,以便TopPlayers组件在PageTop组件内呈现,而RecentGames组件将在PageBottom组件内呈现?谢谢.

javascript reactjs

20
推荐指数
2
解决办法
6万
查看次数

IIS 应用程序池 CLR v4.0 与无托管代码

我目前正在开发一个使用 .Net 核心的应用程序。

我在新应用程序池中的 IIS 管理器上托管了很多微服务。

我想知道应用程序池版本而不是最新的 .NET CLR v4.0 是否有任何优势,不使用托管代码?

我听说没有托管代码选项可以获得更好的性能。真的吗?

谢谢你。

iis iis-8

8
推荐指数
1
解决办法
1万
查看次数

标签 统计

iis ×1

iis-8 ×1

javascript ×1

reactjs ×1