Currently the render method can only return a single element/component. See: here
In the discussion under that ticket some suggest to wrap multiple elements returned
Here's another novel approach if you need this to work with SSR.
Here's a MaxWidth component I am using with my react-based email tool called Myza.
import ReactDOMServer from 'react-dom/server'
export const MaxWidth = ({ maxWidth = 0, className, children }: IMaxWidthProps) => {
const renderedChildren = ReactDOMServer.renderToStaticMarkup(
{children}
)
return
${renderedChildren}
` }}
/>
}
- 热议问题