I wanted to use ReactCSSTransitionGroup to add a little animation to a React and TypeScript project I was working on.
Following the docs:
import ReactCSSTransitionGroup from 'react-addons-css-transition-group'; // ES6
Seems ok. But on doing this, in my .tsx file, I ended up with a compilation error:
Failed to compile. /path/to/my/src/Home/Home.tsx (2,8): Module '"/path/to/my/node_modules/@types/react-addons-css-transition-group/index"' has no default export.
The fix to this came to me, as I’d read this somewhere previously a few months ago when doing my original exploration of TypeScript.
The syntax I really needed was:
import * as ReactCSSTransitionGroup from 'react-addons-css-transition-group';
I honestly can’t remember where I first read this. But hopefully I can at least pass a helpful little tip on to you.