mlmorg / react-hyperscript

Hyperscript syntax for React.js markup
MIT License
710 stars 45 forks source link

Copy properties object to support inextensible records #27

Closed L8D closed 7 years ago

L8D commented 7 years ago

For example, when doing something like:

const SomeComponent = (props) => (
  h('.some-class', props)
);

It fails at TypeError: Can't add property className, object is not extensible because the props object that React passes to pure function components is frozen and/or marked as inextensible.

This PR makes sure we copy the properties object using Object.assign on each call.

L8D commented 7 years ago

@mlmorg let me know if you want me to make this support node v0.12

L8D commented 7 years ago

@mlmorg any update on this?

mlmorg commented 7 years ago

Hey @L8D, really sorry for the delay. We can just support v4+ now. I will land this and update travis / documentation.

mlmorg commented 7 years ago

Published as v3.0.0