React-transition-group: Standard ES6 imports fail

Created on 13 Jul 2017  路  5Comments  路  Source: reactjs/react-transition-group

I'm using a standard npm install in an ES6 project that's compiled using typescript (ts-loader in webpack without babel), imports from docs fail for me:

import TransitionGroup from 'react-transition-group/TransitionGroup';

While this works:

import { TransitionGroup } from 'react-transition-group';

I might suggest updating the docs to use the 2nd syntax if it's less problematic, or listing both as options if it varies depending on the build environment.

Most helpful comment

I'm having an issue with this too. Although I'm trying to import Transition. TypeScript throws this error:

error TS2604: JSX element type 'Transition' does not have any construct or call signatures.

I'm using the docs import method

import Transition from "react-transition-group/Transition";.

Changing it to

import { Transition } from "react-transition-group";

doesn't work. It actually throws an extra error:

error TS2497: Module '".../node_modules/@types/react-transition-group/index"' resolves to a non-module entity and cannot be imported using this construct.

All 5 comments

It really should not vary... I'm really not sure why typescript would work here. It works for normal es6 imports. Hmm

I'm having an issue with this too. Although I'm trying to import Transition. TypeScript throws this error:

error TS2604: JSX element type 'Transition' does not have any construct or call signatures.

I'm using the docs import method

import Transition from "react-transition-group/Transition";.

Changing it to

import { Transition } from "react-transition-group";

doesn't work. It actually throws an extra error:

error TS2497: Module '".../node_modules/@types/react-transition-group/index"' resolves to a non-module entity and cannot be imported using this construct.

We don't control the @types/react-transition-group types so they are probably out of date

@wedelgaard same, how can you solve this issue?

Closing as this is a TS-specific issue.

Was this page helpful?
0 / 5 - 0 ratings