react-mdl icon indicating copy to clipboard operation
react-mdl copied to clipboard

Support for immutable-js objects

Open ahoereth opened this issue 9 years ago • 1 comments

(Most?) react-mdl components, e.g. DataTable, only support js native arrays and objects as props. React itself also allows for direct use of immutable-js (and similar) datatypes since 0.13:

Support for iterators and immutable-js sequences as children.

Changing this behavior currently is as easy as replacing PropTypes.arrayOf(...) or similar with PropTypes.any.

I am currently planning on solving this using a function custom type checker testing the objects constructor name. Any input on this?

PropTypes.oneOfType([
  PropTypes.arrayOf(PropTypes.object),
  function(props, propName, componentName) { [...] },
])

ahoereth avatar Aug 09 '16 18:08 ahoereth

Great! How would you check if it's an iterator or immutable-js object?

tleunen avatar Aug 09 '16 18:08 tleunen