react icon indicating copy to clipboard operation
react copied to clipboard

ReactTransitionGroup should consume `component` prop.

Open hallister opened this issue 11 years ago • 3 comments

When given a component prop ReactTransitionGroup will pass the prop on.

When passing ReactTransitionGroup a factory for a component that also uses a component prop in similar fashion it will result in a warning:

Warning: Failed propType: Invalid prop `component` supplied to `CustomComponent`.
Check the render method of `ReactTransitionGroup`.

Is there a legitimate use for not consuming the prop? This doubles as a problem since it causes a warning and requires that any component which can be a child of ReactTransitionGroup must also make sure that it's component prop doesn't equal itself.

Whoops, forgot that this exists in 0.14.0-rc1.

hallister avatar Sep 23 '15 21:09 hallister

No, this is probably unintentional.

sophiebits avatar Sep 25 '15 00:09 sophiebits

var ReactTransitionGroup = React.createClass({
  // ...
  render: function() {
    // ...
    return React.createElement(
      this.props.component,
      this.props,

Because props is a sealed object, consuming property can be expensive.

piglovesyou avatar Feb 28 '16 15:02 piglovesyou

I’m going to close since we don’t plan any more changes to TransitionGroup in React repo. Instead, it now is maintained by the community, and you can file an issue in the new repository if this is still affecting you. Thanks!

gaearon avatar Jan 27 '17 14:01 gaearon