Re: [w3c/webcomponents] [idea] Not having <slot> element get in the way of structure. (#589)

What I like about React, is that distribution into the inner tree doesn't involve elements, which is what indirectly inspired me to write this idea. In React, the HTML markup is separate from distribution logic. The markup is just that, markup representing content, not any sort of logic. For example, in React:

```jsx
function SomeReactComponent(props) {
  return (
    <div slot="slotName">
      <img><br>
      {props.children /* we insert children here */ }
    </div>
  )
}
```

or


```jsx
function SomeReactComponent(props) {
  return (
    <div slot="slotName">
      <img>
      {props.children /* we insert children here */ }
      <br>
    </div>
  )
}
```

or

```jsx
function SomeReactComponent(props) {
  return (
    <div slot="slotName">
      {props.children.filter(child => ... ) /* we insert some children here */ }
      <img>
      <br>
      {props.children.filter(child => !... ) /* and put the rest here */ }
    </div>
  )
}
```

See how that is separate from the markup which defines the content?

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/w3c/webcomponents/issues/589#issuecomment-254657670

Received on Tuesday, 18 October 2016 22:27:24 UTC