简体   繁体   中英

import ReactCSSTransitionGroup in ES6 React Javascript

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 components 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?

import ReactCSSTransitionGroup from 'react/lib/ReactCSSTransitionGroup';

你应该像这样导入。

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM