Doesn't work: require ('response / addons')

I am using ReactJS and Browserify. I can't figure out why this one require

doesn't give me access to ReactCSSTransitionGroup

:

    var React = require('react/addons');

      

I tried adding this and it still doesn't work:

    var ReactCSSTransitionGroup = React.ReactCSSTransitionGroup;

      

To make it work, I had to add:

    var ReactCSSTransitionGroup = require("react/lib/ReactCSSTransitionGroup");

      

How to access everyone addons

through require('react/addons')

:?

+3


source to share


1 answer


The react / addons requirement simply adds an addons object to React and exports React.

React.addons = {
  CSSTransitionGroup: ReactCSSTransitionGroup,
  LinkedStateMixin: LinkedStateMixin,
  ...

module.exports = React;

      



As in the docs , you can find the animation addon at React.addons.CSSTransitionGroup

.

Side note: the requirement for "react" and "react / addons" does not include react twice. Some people have asked this in the past, so I just want to clarify.

+3


source







All Articles