simon360 / react-from-markup

Declare your React components with static HTML
MIT License
18 stars 4 forks source link

Skip nested markup containers #33

Closed monospaced closed 5 years ago

monospaced commented 5 years ago

Currently nesting markup containers like this could lead to buggy behaviour:

<div data-react-from-markup-container>
  <div data-rehydratable="HatComponent">…</div>
  <div data-react-from-markup-container>
    <div data-rehydratable="ShoesComponent">…</div>
  </div>
</div>

Add a check to skip markup containers if they are inside a parent container, potentially something like:

roots.some(r => r.contains(root)
willtonkin commented 5 years ago

I'm taking at a look at this now, PR to follow