react-transition-group README

The project's README from github.com/reactjs/react-transition-group. As one markdown file: README.md.

react-transition-group npm

ATTENTION! To address many issues that have come up over the years, the API in v2 and above is not backwards compatible with the original React addon (v1-stable).

For a drop-in replacement for react-addons-transition-group and react-addons-css-transition-group, use the v1 release. Documentation and code for that release are available on the v1-stable branch.

We are no longer updating the v1 codebase, please upgrade to the latest version when possible

A set of components for managing component states (including mounting and unmounting) over time, specifically designed with animation in mind.

Documentation

TypeScript

TypeScript definitions are published via DefinitelyTyped and can be installed via the following command:

npm install @types/react-transition-group

Examples

Clone the repo first:

[email protected]:reactjs/react-transition-group.git

Then run npm install (or yarn), and finally npm run storybook to start a storybook instance that you can navigate to in your browser to see the examples.

react-transition-group (reactjs/react-transition-group)

Searching Database…

这是什么?react-transition-group 是一组 React 组件,用于管理组件随时间变化的状态,包括挂载和卸载,专为动画场景设计。
它是框架还是小型库?它是一个轻量级的 React 组件库(Transition、CSSTransition、TransitionGroup、SwitchTransition),你可以把这些组件组合到自己的 React 应用中使用,它本身不是独立的框架。
我该如何把它添加到项目中?通过 npm 或 yarn 将其作为依赖安装,然后在 React 代码中导入所需的组件(Transition、CSSTransition 等);TypeScript 类型定义可通过 DefinitelyTyped 另行获取。
除了 React,它还需要什么?它底层依赖 dom-helpers、prop-types、loose-envify 和 @babel/runtime,并且只能在 React 项目中使用。
v2+ 能直接替换旧的 React 插件吗?不能。v2+ 的 API 与原来的 react-addons-transition-group / react-addons-css-transition-group 不向后兼容;如需直接替换,你需要使用 v1 版本,但该版本已不再更新。
我该如何试用这些示例?克隆仓库,运行 npm install(或 yarn),然后执行 npm run storybook,即可在浏览器中启动本地 Storybook,查看可实际运行的示例。
如果我之前用的是旧的 react-addons-transition-group,要不要升级?你可以继续使用 v1-stable,因为它与旧插件的 API 保持一致;但 react-transition-group 已不再更新该分支,因此新项目应按照提供的迁移指南升级到 v2+。
我实际从这个包中导入的是什么?是 Transition、CSSTransition、TransitionGroup 和 SwitchTransition 等组件,让你可以在 React 元素挂载、更新和卸载时为其添加动画。
Creator
reactjs
Size
14.2 MB
Stars
10.2K
Age
9y
Commits · 90 Days