React-transition-group: Expected a string...

Created on 14 Aug 2017  路  11Comments  路  Source: reactjs/react-transition-group

Warning: React.createElement: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: undefined. You likely forgot to export your component from the file it's defined in. Check your code at index.js:19.

import React, { Component } from 'react'
import { CSSTransitionGroup } from 'react-transition-group';

let itemList = ["one", "two", "three"];

class About extends Component {

  render() {

    const items = itemList.map((item, i) => {
      return (
      <div key={item}>
        {item}
      </div>
    )});

    return (
        <div>
          <CSSTransitionGroup
            transitionName="example"
            transitionEnterTimeout={500}
            transitionLeaveTimeout={300}>
            {items}
          </CSSTransitionGroup>
        </div>
    )
  }
}

export default About;

This may be something simple i'm overlooking, but no matter what I try I keep getting this error. Could someone please lend a hand.

Most helpful comment

Just ran into the same error. I reverted back to:
npm install --save [email protected]

All 11 comments

Sounds like you may be using the v1I with v2, there is no CSSTransitionGroup component anymore

https://reactcommunity.org/react-transition-group/

Is this what i should be working with now?

yes

These docs are confusing me like hardcore. I can see how useful this can be, but i just can't figure it out.

Just ran into the same error. I reverted back to:
npm install --save [email protected]

Yeah this is absolutely confusing, have the same problem. @mattcarlotta solution also doesn't work for me unfortunately :(

ya'll there is no CSSTransitiongroup component anymore, that's why the error happens.

@jquense what do you mean there is no CSSTransitionGroup anymore? How do I use this package? Is it still being supported? I am very confused.

How do I use this package?

@jhanstra please read the documentation http://reactcommunity.org/react-transition-group/

JFWIW I don't remember it exactly anymore, but I tried multiple old versions of this package and one of the old versions started to work with my react version then.. It was a version missmatch, which didn't trigger any warnings but lead to this error.

Hi! I was with the same Issue and according to the previous comments effectively that component is out of date, I was googling and found this migration guide, I hope you find this useful
https://github.com/reactjs/react-transition-group/blob/master/Migration.md

Was this page helpful?
0 / 5 - 0 ratings

Related issues

r-tock picture r-tock  路  5Comments

vedimension picture vedimension  路  5Comments

heaversm picture heaversm  路  5Comments

lukasreusch picture lukasreusch  路  4Comments

Kylian030903 picture Kylian030903  路  3Comments