wix-incubator / react-templates

Light weight templates for react
https://wix.github.io/react-templates
MIT License
2.82k stars 207 forks source link

feature request: rt-template with in-place child component (not a function) #214

Open yatra9 opened 7 years ago

yatra9 commented 7 years ago

Hello.

It would be nice if rt-template has a option to put a React component itself (not a function) as a child property.

I use Microsoft's WinJS toolkit through react-winjs. Some react-winjs components require other renderable React components as their properties.

For example, the ReactWinJS.SplitView of this sample code has child properties paneComponent and contentComponent which are also React components.

For example, rt-template with in-place property (instead of arguments property) makes sense?

<ReactWinJS.SplitView
  id={splitViewId}
  <rt-template prop="paneComponent" in-place />
     <div>...</div>
  </rt-template>
  <rt-template prop="contentComponent" in-place />
     <h2 className="win-h2" >{this.state.content}</h2>
  </rt-template>
</ReactWinJS.SplitView>
nippur72 commented 7 years ago

Yes, this is something we really need if we want to talk with other libraries (WinJs but also MaterialUI, Antd etc). We discussed it in various places, see #209, #103, #150 and #155.

yatra9 commented 7 years ago

Sorry for duplicate issue. I was not aware of those.

By the way, the tag name rt-template is a little bit weird, I think. rt-inject or rt-modify etc. would be fit better?