简体   繁体   中英

Wrap div not rendering in React

I have a render() function that returns a div with content inside of it, such as:

return(
    <div style={{background: "black"}}>
        <[ReactComponent]>
            <[AnotherReactComponent]>
                ...
            </[AnotherReactComponent]>
        </[ReactComponent]>
    </div>
);

When I inspect the element, the outer div does not render, however the ReactComponent does.

也许你应该在 RComponent 的 render 方法中添加一些这样的构造

<View>{props.children}</View>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM