React Shuffle 使用教程

React Shuffle 使用教程

react-shuffleAnimated shuffling of child components on change项目地址:https://gitcode.com/gh_mirrors/re/react-shuffle

1. 项目的目录结构及介绍

React Shuffle 项目的目录结构如下:

react-shuffle/
├── LICENSE
├── README.md
├── package.json
├── examples/
│   ├── basic/
│   ├── custom-transition/
│   ├── dynamic-children/
│   ├── index.html
│   ├── index.js
│   ├── nested-children/
│   ├── no-animate/
│   ├── resize/
│   └── transition-group/
├── src/
│   ├── Animate.js
│   ├── Shuffle.js
│   ├── index.js
│   ├── utils/
│   │   ├── debounce.js
│   │   ├── get-item-dimensions.js
│   │   ├── get-item-transform.js
│   │   ├── get-transition-props.js
│   │   ├── index.js
│   │   ├── is-element-of-type.js
│   │   ├── noop.js
│   │   ├── raf.js
│   │   ├── request-animation-frame.js
│   │   ├── set-item-transition.js
│   │   └── throttle.js
│   └── vendor/
│       └── tween-state.js
└── yarn.lock

目录结构介绍

  • LICENSE: 项目许可证文件。
  • README.md: 项目说明文档。
  • package.json: 项目依赖和脚本配置文件。
  • examples/: 包含多个示例项目,展示了 React Shuffle 的不同用法。
  • src/: 项目源代码目录,包含核心组件和工具函数。
    • Animate.js: 动画组件。
    • Shuffle.js: 核心 Shuffle 组件。
    • index.js: 入口文件。
    • utils/: 工具函数目录。
    • vendor/: 第三方库目录。

2. 项目的启动文件介绍

项目的启动文件主要是 examples/index.js,它负责加载和展示不同的示例项目。

import React from 'react';
import ReactDOM from 'react-dom';
import Basic from './basic';
import CustomTransition from './custom-transition';
import DynamicChildren from './dynamic-children';
import NestedChildren from './nested-children';
import NoAnimate from './no-animate';
import Resize from './resize';
import TransitionGroup from './transition-group';

const examples = {
  Basic,
  CustomTransition,
  DynamicChildren,
  NestedChildren,
  NoAnimate,
  Resize,
  TransitionGroup,
};

const Example = () => {
  const example = window.location.hash.slice(1) || 'Basic';
  const Component = examples[example];
  return <Component />;
};

ReactDOM.render(<Example />, document.getElementById('root'));

启动文件介绍

  • examples/index.js: 根据 URL 的 hash 值加载对应的示例项目。
  • examples/basic/, examples/custom-transition/, 等: 各个示例项目的入口文件。

3. 项目的配置文件介绍

项目的配置文件主要是 package.json,它包含了项目的依赖、脚本和其他配置信息。

{
  "name": "react-shuffle",
  "version": "4.1.1",
  "description": "React content shuffling component",
  "main": "lib/index.js",
  "module": "es/index.js",
  "files": [
    "css",
    "es",
    "lib",
    "umd"
  ],
  "scripts": {
    "build": "nwb build-react-component",
    "clean": "nwb clean-module && nwb clean-demo",
    "start": "nwb serve-react-demo",
    "test": "nwb test-react",
    "test:coverage": "nwb test-react --coverage",
    "test:watch": "nwb test-react --server"
  },
  "dependencies": {
    "prop-types": "^15.6.2",
    "raf": "^3.4.1",
    "tween-state": "^0.1.5"
  },
  "peerDependencies

react-shuffleAnimated shuffling of child components on change项目地址:https://gitcode.com/gh_mirrors/re/react-shuffle

  • 1
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

周情津Raymond

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值