Description
react-transition-state is a small React library for animating components in and out of the page with a hook. It is a transition state machine with no dependencies, inspired by React Transition Group, and it works with both CSS transitions and CSS animations. Unlike React Transition Group, it uses a single state rather than derived state driven by an in prop, which the README presents as a simpler model. The hook moves a component through its enter and exit states and can move elements into and out of the DOM. Each state change causes at most one extra render in the component that uses it. The README gives examples with plain CSS, styled-components and Tailwind CSS, and it shows how to build a switch transition with useTransitionState for a fixed number of elements or useTransitionMap for a number known only at run time. A transition can also be turned on in a useEffect when a component mounts. The library is listed at about 650 bytes after tree-shaking. Install it from npm, and the project has a live demo and a state diagram in the README.…
Highlights
- Hook-based transition state machine for React
- Works with CSS transitions and animations
- No dependencies and no derived state
- Switch transitions with useTransitionState and useTransitionMap
- About 650 bytes after tree-shaking
Ratings & Reviews
No ratings yet
Be the first to rate React Transition State.
People also visit
React Transition State FAQ
What is react-transition-state?
A small, zero-dependency React library for animating component transitions with a hook.
How does it differ from React Transition Group?
The README says it uses one state instead of derived state from an in prop, and each state change causes at most one extra render.
Does it work with my CSS setup?
The README includes examples for plain CSS, styled-components and Tailwind CSS.
How big is it?
The README says about 650 bytes after tree-shaking.
How do I install it?
Install it from npm, as shown in the install section of the README.
What are the best React Transition State alternatives?
Popular alternatives to React Transition State include SSGOI, Next Transition Router and React Nprogress. See all React Transition State alternatives













