Security News
Research
Supply Chain Attack on Rspack npm Packages Injects Cryptojacking Malware
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
@types/react-transition-group
Advanced tools
TypeScript definitions for react-transition-group
The @types/react-transition-group package provides TypeScript type definitions for the react-transition-group library, which is a React component toolset for managing animations and transitions. It allows developers to define entering and exiting transitions for components in React applications.
Transition
The Transition component lets you describe a transition from one component state to another over time with a simple declarative API. The example shows a fade effect applied to a component.
{"import React from 'react';\nimport { Transition } from 'react-transition-group';\n\nconst duration = 300;\n\nconst defaultStyle = {\n transition: `opacity ${duration}ms ease-in-out`,\n opacity: 0,\n};\n\nconst transitionStyles = {\n entering: { opacity: 1 },\n entered: { opacity: 1 },\n exiting: { opacity: 0 },\n exited: { opacity: 0 },\n};\n\nconst Fade = ({ in: inProp }) => (\n <Transition in={inProp} timeout={duration}>\n {state => (\n <div style={{\n ...defaultStyle,\n ...transitionStyles[state]\n }}>\n I'm a fade Transition!\n </div>\n )}\n </Transition>\n);"}
CSSTransition
CSSTransition applies a pair of class names during the appear, enter, and exit states of the transition. The example demonstrates how to use it for a fade effect.
{"import React from 'react';\nimport { CSSTransition } from 'react-transition-group';\n\nconst Fade = ({ in: inProp }) => (\n <CSSTransition\n in={inProp}\n timeout={300}\n classNames='fade'\n >\n <div className='fade'>I'm a fade CSSTransition!</div>\n </CSSTransition>\n);\n\n// CSS\n.fade-enter {\n opacity: 0.01;\n}\n.fade-enter-active {\n opacity: 1;\n transition: opacity 300ms ease-in;\n}\n.fade-exit {\n opacity: 1;\n}\n.fade-exit-active {\n opacity: 0.01;\n transition: opacity 300ms ease-in;\n}"}
TransitionGroup
TransitionGroup manages a set of transition components (like CSSTransition) in a list. It's useful for animating lists or groups of elements entering and exiting. The example shows a todo list where items fade in and out.
{"import React from 'react';\nimport { TransitionGroup, CSSTransition } from 'react-transition-group';\n\nfunction TodoList({ todos }) {\n return (\n <TransitionGroup className='todo-list'>\n {todos.map(({ id, text }) => (\n <CSSTransition\n key={id}\n timeout={500}\n classNames='item'\n >\n <div>{text}</div>\n </CSSTransition>\n ))}\n </TransitionGroup>\n );\n}"}
Framer Motion is a popular library for animations in React. It offers more comprehensive animation features like spring physics and gesture animations, compared to react-transition-group which focuses on simpler transition effects.
React Spring is a spring-physics based animation library that can be used to create a wide variety of animations. It provides more control over animations compared to react-transition-group, especially for complex animations based on physics.
React Motion is a library that simplifies the implementation of animations in React applications. It focuses on a more declarative way to define animations using spring configurations, offering a different approach compared to react-transition-group's transition and CSS-based animations.
npm install --save @types/react-transition-group
This package contains type definitions for react-transition-group (https://github.com/reactjs/react-transition-group).
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/react-transition-group.
These definitions were written by Karol Janyst, Epskampie, Masafumi Koba, and Ben Grynhaus.
FAQs
TypeScript definitions for react-transition-group
The npm package @types/react-transition-group receives a total of 9,160,527 weekly downloads. As such, @types/react-transition-group popularity was classified as popular.
We found that @types/react-transition-group demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.
Security News
Sonar’s acquisition of Tidelift highlights a growing industry shift toward sustainable open source funding, addressing maintainer burnout and critical software dependencies.