最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

reactjs - import ReactCSSTransitionGroup in ES6 React Javascript - Stack Overflow

programmeradmin5浏览0评论

I am using NPM to manage my packages and modules on my node.js app.

I have updated react to ^0.14.6 version and also installed ReactCSSTransitionGroups via npm.

Unfortunately uppon trying to use this addon in one of my child ponents I face the following error which says that its still undefined:

Uncaught ReferenceError: ReactCSSTransitionGroup is not defined

My implementation code:

import React from 'react';
import CSSTransitionGroup from 'react-addons-css-transition-group';

Usage is within a maping function:

...
return(
   <ReactCSSTransitionGroup transitionName="example">
      {Content}
   </ReactCSSTransitionGroup>
);
...

Does anyone know how to fix this?

I am using NPM to manage my packages and modules on my node.js app.

I have updated react to ^0.14.6 version and also installed ReactCSSTransitionGroups via npm.

Unfortunately uppon trying to use this addon in one of my child ponents I face the following error which says that its still undefined:

Uncaught ReferenceError: ReactCSSTransitionGroup is not defined

My implementation code:

import React from 'react';
import CSSTransitionGroup from 'react-addons-css-transition-group';

Usage is within a maping function:

...
return(
   <ReactCSSTransitionGroup transitionName="example">
      {Content}
   </ReactCSSTransitionGroup>
);
...

Does anyone know how to fix this?

Share Improve this question edited Jan 7, 2016 at 19:55 noa-dev asked Jan 7, 2016 at 19:47 noa-devnoa-dev 3,6419 gold badges35 silver badges73 bronze badges
Add a ment  | 

2 Answers 2

Reset to default 15
import ReactCSSTransitionGroup from 'react/lib/ReactCSSTransitionGroup';

you should import like this.

You're importing CSSTransitionGroup but using ReactCSSTransitionGroup. Switch one or the other so the variable lines up.

发布评论

评论列表(0)

  1. 暂无评论