3

So I cannot figure out why people like to call the React Transition Functions in the different ways by

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

ReactCSSTransitionGroup import ReactCSSTransitionGroup from 'react-transition-group'

CSSTransitionGroup import CSSTransitionGroup from 'react-transition-group/CSSTransitionGroup'

So, the question is there some differenses (performance, functionality) between these invokes or it just on the mind of the developer - how to call the Transition from react-transition-group...

P.S. I do not find the answer on this question in the web.

I'll be pleased for any help...

Codebling
  • 10,764
  • 2
  • 38
  • 66
Sviat Kuzhelev
  • 1,758
  • 10
  • 28

1 Answers1

1

Based on the index.js the following are the same:

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

The since CSSTransition exports a default class the following is misleading:

import TransitionGroup from 'react-transition-group/CSSTransition'
import AnyThing from 'react-transition-group/CSSTransition'
Ryan Schumacher
  • 1,816
  • 2
  • 21
  • 33
  • Thank you! But the question is about another - is there some differenses in the functionality of these Transition functions? ) – Sviat Kuzhelev May 15 '18 at 14:19
  • @SviatKuzhelev: As shown in the `index.js` link, they all refer to the exact same object. There's no functional difference between which one you use. – Joe Clay May 15 '18 at 14:21
  • @JoeClay in the `index.js` it says next: `import CSSTransition from './CSSTransition'; import ReplaceTransition from './ReplaceTransition'; import TransitionGroup from './TransitionGroup'; import Transition from './Transition';` . I my opinion these four classes are linked from different files... Or I'm wrong? – Sviat Kuzhelev May 15 '18 at 14:28
  • They are linked to different classes. – Ryan Schumacher May 15 '18 at 14:56
  • https://github.com/reactjs/react-transition-group/blob/master/src/TransitionGroup.js – Ryan Schumacher May 15 '18 at 14:57
  • https://github.com/reactjs/react-transition-group/blob/master/src/CSSTransition.js – Ryan Schumacher May 15 '18 at 14:58
  • @SviatKuzhelev maybe the confusion is that above you say CSSTransitionGroup but that’s not correct. It is CSSTransition. The transition group class allows you to group multiple transitions (ie CSSTransition) – Ryan Schumacher May 15 '18 at 15:00
  • So, as you say `They are linked to different classes`, in that way we can suppouse, that if they are all linked to different classes, they also have different methods/functions? @RyanSchumacher – Sviat Kuzhelev May 15 '18 at 15:11
  • https://github.com/reactjs/react-transition-group/blob/master/src/CSSTransition.js#L99-L115 – Ryan Schumacher May 15 '18 at 15:24
  • https://github.com/reactjs/react-transition-group/blob/master/src/TransitionGroup.js#L62-L81 – Ryan Schumacher May 15 '18 at 15:25