npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

react-transition-manager

v1.3.2

Published

A robust transition component for React projects

Readme

TransitionManager

A robust transition component for React projects which can handle the stress. It can cope with multiple, simultaneous transitions being queued up in quick succession as well as changes to these part way through.

Why?

I was looking for a transition component that allows for smooth page changes which can be tied to the browser history. Since the user can navigate the history at any rate they wish, the transition component would need to be able to juggle multiple transitions at a time. It seemed clear that any transitioning elements needed to be cached in some stateful manner in order to keep tabs on them between renders. Unfortunately none of the existing transition components seemed to support this idea, so subsequent renders would not be aware of any transitioning elements and they would be removed prematurely.

How it works

Inspired by React's own ReactCSSTransitionGroup component, TransitionManager allows you to simply declare the children you want to see, leaving the nasty diffing logic to React. Additionally, to cope with transitionends not firing in certain cases, it employs a setTimeout safety net just as the clever TimeoutTransitionGroup from Khan Academy. It will then keep track of all children in its internal state, whether they are entering, leaving or persisting, whilst adding classes to them to trigger the appropriate css transitions. Children are only removed after the timeout is complete and all timeouts are allowed to run to their conclusion regardless of the number of render calls taking place inbetween.

Transition cycle

Children will receive the following classes as props at each stage of their transition cycle. Please note, you will need to apply these classes to the children manually.*

  • add for new elements
    • prepare them for entry transition
  • add show for entering elements
    • show is added on the next tick in order to trigger the enter css transition
  • add show hide for leaving elements
    • hide is added in order to trigger the leave css transition
  • element is removed from the dom after timeout duration

* this is subject to change in a future version as this would best be automated by TransitionManager.

Usage

Example Parent

Using a similar api to TimeoutTransitionGroup, you need to pass in a duration value in ms for the leave timeouts. All children must have a unique key so TransitionManager can keep tabs on each child. E.g.

app.js

import TransitionManager from 'react-transition-manager';
const App = React.createClass({
  render() {
    let page;
    switch(this.props.pageId) {
      case 'home':
        page = <Home key="home" />;
        break;
      case 'about':
        page = <About key="about" />;
        break;
      case 'contact':
        page = <Contact key="contact" />;
        break;
    }
    return (
      <TransitionManager component="div" duration={1000}>
        {page}
      </TransitionManager>
    );
  }
});
export default App;
  • all passed props (id, className etc) will be applied to the rendered dom
  • component attribute allows for overriding the default <span> element type.

Example Child

The classes are passed down to the child components in the className property. These need to be applied during the render method to take affect.

Additionally the current transitionState is also passed as prop in case it's needed in the render logic.

home.js

var Home = React.createClass({
  render: function() {
    return (
      <div className={this.props.className}>
        Page is currently {this.props.transitionState}
      </div>
    );
  }
});
export default Home;

Demos

collingo.com/react-transition-manager

License

MIT