反应典型
使用 TypeScript 支持在 React 中制作的打字库 @ deadcoder0904 (英语)
要点
- 在类型脚本中写入
- 零依赖关系
- 麻省理工学院执照
- 爱莫吉支持
- 暂停: 步骤之间暂停
- 循环: 从任意点轻松循环
- 人类: 打字速度略有变化
安装
$ npm install @deadcoder0904/react-typical
使用量
基础
import React from 'react'
import { ReactTypical } from '@deadcoder0904/react-typical'
const Index = () => (
<ReactTypical
steps={['Hello', 'React Typical']}
wrapper="p"
/>
)
爱莫吉支持
import React from 'react'
import { ReactTypical } from '@deadcoder0904/react-typical'
const Index = () => (
<ReactTypical
steps={['💩',1000, '🙈',1000,'💖',1000,'🚀',1000,'👨🎤',1000]}
wrapper="p"
/>
)
暂停
为了在任何时间暂停,将若干毫秒传递给 steps 暂停.
import React from 'react'
import { ReactTypical } from '@deadcoder0904/react-typical'
const Index = () => (
<ReactTypical
steps={['Hello', 1000, 'React Typical', 2000]}
wrapper="p"
/>
)
循环
为了循环,只需传递一个数字到 loop 例如道具,如果你想循环3次.
import React from 'react'
import { ReactTypical } from '@deadcoder0904/react-typical'
const Index = () => (
<ReactTypical
steps={['Hello', 1000, 'React Typical', 2000]}
loop={3}
wrapper="p"
/>
)
或者通过 Infinity 无限循环.
import React from 'react'
import { ReactTypical } from '@deadcoder0904/react-typical'
const Index = () => (
<ReactTypical
steps={['Hello', 1000, 'React Typical', 2000]}
loop={Infinity}
wrapper="p"
/>
)
API 密码
| 属性 | 所需经费 | 类型 | 实例 |
|---|---|---|---|
steps | 对 | [ | ['Hello', 1000, 'React Typical', 500] |
wrapper | 没有 | 字符串 | 'p' 或者说 'div' |
loop | 没有 | 编号 | 3 或者说 Infinity |
动机和激励
我想在React里用一个打字库 和TypeScript一起 但找不到 我发现有个反打字图书馆 反应典型 用于 @camwiegert/ 常规 但两个库都没有用TypeScript写出. 所以,我做了一个库 它只是使用完全相同的代码 但在TypeScript(英语:TypeScript)(TypeScript)中 它太麻烦了,不能把它转换成TypeScript。 10/10不会建议.