1.0.0 • Published 5 years ago

rendez v1.0.0

Weekly downloads
5
License
LGPL-3.0
Repository
github
Last release
5 years ago

rendez

Build Status Coverage Status

Rendez means to order / to arrange in hungarian, and brings order to your react subtrees.

It will merge two react subtrees, A and B, while arranging the elements from subtree B into the order given by subtree A, based on their key, and merging their props.

This was created as a way to make React Overlays possible in intl-codegen

Example

A

<>
  <em key="a" className="a-has-precedence">
    A
  </em>{" "}
  will provide the surrounding non-element nodes, as well as the <em key="order" /> in which to arrange the elements,
  and <em>B</em> will provide: <div key="provide" />
</>

B

<>
  <em key="order">*order*</em>
  <ul key="provide">
    <li>the element type</li>
    <li>some props, unless overridden by A</li>
    <li>and some children, unless overridden by A</li>
  </ul>
  <em key="a" className="sad-b">
    has both its className and children overridden :-(
  </em>
</>

Result

<em class="a-has-precedence">A</em> will provide the surrounding non-element nodes, as well as the <em>*order*</em> in
which to arrange the elements, and <em>B</em> will provide:
<ul>
  <li>the element type</li>
  <li>some props, unless overridden by A</li>
  <li>and some children, unless overridden by A</li>
</ul>