Need a way to use Html.React without inserting wrapper element
I'm attempting to use MDL with React. My layout is:
<div class="mdl-layout mdl-js-layout mdl-layout--fixed-header">
@Html.React("LayoutHeader", new { pageModel = headerModel }, "header", containerClass: "mdl-layout__header")
@Html.React("LayoutDrawer", new { pageModel = headerModel })
<main class="mdl-layout__content"></main>
</div>
MDL requires it's elements to be direct children, like so:
<div layout>
<header>
<drawer>
<content>
</div layout>
I was able to make the header component work since the MDL template had an element I could wrap, however, the drawer only has one element, then multiple children (which I can't do within the Render() method).
Is there a way to have HTML.React output the render directly without inserting a wrapper element?
The common solution to this in React is to render() multiple children in a simple <div></div>. See if that works.
Yeah, you'll probably need to wrap the children in a div, as noted above.