Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Any support for "Insertion Points"? #2318

Closed
tiye opened this issue Oct 10, 2014 · 2 comments
Closed

Any support for "Insertion Points"? #2318

tiye opened this issue Oct 10, 2014 · 2 comments

Comments

@tiye
Copy link

tiye commented Oct 10, 2014

In Web Components <content> is used as an intertion point.
http://www.w3.org/TR/2013/WD-components-intro-20130606/#insertion-points
If there's something in React does the work, it could be like this:

A = React.createClass
  render: -> $.div {}, 'A'

B = React.createClass
  render: -> $.div {}, 'B'

A({}, B({})) # not supposed to work

or even:

<A>
  <div>whatever</div>
</A>

I only find #848 about inserting components by sending them as props. That looks quite ugly when I have several nodes to insert:

<A>
  <div>whatever</div>
  <div>whatever 2</div>
  <div>whatever 3</div>
</A>

Are there any better solutions?

@syranide
Copy link
Contributor

In Web Components is used as an intertion point.

<div>{this.props.children}</div>

But I'm not really sure what you are actually asking for, your last example is done using the above "insertion point" as well. If you want multiple insertion points you either have to use props or filter this.props.children and pick out the ones you want (either by type or some prop).

@tiye
Copy link
Author

tiye commented Oct 10, 2014

Sorry, I'm not that familiar with those terms and have to express by examples.

I think this.props.children is what I need here. A single insertion point is OK for my case.

Maybe I should relate these docs there, though use cases of this.props.children is not explicitly demod:
http://facebook.github.io/react/docs/multiple-components.html#children
http://facebook.github.io/react/tips/children-props-type.html

@tiye tiye closed this as completed Oct 10, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants