React-transition-group: Module not found: 'react-transition-group/CSSTransitionGroup' error

Created on 18 Apr 2017  路  4Comments  路  Source: reactjs/react-transition-group

Hello,

I'm probably being an idiot, but can't figure how to import react-transition-group into my project correctly.

I've done an npm install https://github.com/reactjs/react-transition-group.git --save which works fine. Then I do import CSSTransitionGroup from 'react-transition-group/CSSTransitionGroup';
This throws a Module not found: 'react-transition-group/CSSTransitionGroup' error.

Looking into it it appears to be that in package.json that main points to lib/index.js which doesn't exist, and I guess only exists if you build the project.

So...do I need to build the project myself within my dependencies, or am I being an idiot and this is not the right way to use this project at all (more likely :))

Thanks!!

Most helpful comment

@stuartmemo

import { CSSTransitionGroup } from 'react-transition-group'

All 4 comments

You can't really install from github directly without building it. the directory setup is different than what gets sent to npm. I suggest installing it normally with npm install react-transition-group

Gah, I didn't think it existed on npm for the stupid reason that it didn't have a README on the npm page but this GitHub repo did. Anyway, sorry, appreciate the quick reply!!

@stuartmemo

import { CSSTransitionGroup } from 'react-transition-group'

@jaywcjlove You just saved my life

Was this page helpful?
0 / 5 - 0 ratings