i-like-robots / hyperons

🔥 The fastest JSX to string renderer on the server and in the browser.
https://www.npmjs.com/package/hyperons
MIT License
45 stars 4 forks source link

Fix passing children through higher-order components #12

Closed i-like-robots closed 6 years ago

i-like-robots commented 6 years ago

Example:

function Link (props) {
  return <a href={props.url} className={props.className}>{props.children}</a>
}

function FancyLink (props) {
  return <Link {...props} className="Fancyness">{props.children}</Link>
}

function MyFancyLink (props) {
  return <FancyLink url="http://www.google.com">Fancy Google</FancyLink>
}

Output before:

<a href="http://www.google.com" class="Fancyness"></a>

Output after:

<a href="http://www.google.com" class="Fancyness">Fancy Google</a>
coveralls commented 6 years ago

Coverage Status

Coverage increased (+0.2%) to 96.053% when pulling b0aec75bb9b7abf083958bb65b37a1411623fd71 on support-children-as-props into 2ae71ef836d6c47ed3d9186e26a31bc33b54c71e on master.