【分享創造】react-typewriter-hook: 用react hooks來實現打字機的效果

react-typewriter-hook

⌨️ 使用react hooks來輕鬆實現打字機的效果

https://github.com/haowen737/react-typewriter-hook/blob/master/doc/example.gif

安裝

npm i react-typewriter-hook --save

例子

View example at codesandbox

使用

// useTypewriter will do these things
// Once Word changed, typewritter will automatically erase last word
// Then type down new word
import useTypewriter from "react-typewriter-hook"

function MagicWriter(word) {
  const typing = useTypewriter(word)
  return typing
}
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章