1.0.1-beta.1 • Published 4 years ago

@xiaguochang/react-typewriter-hook v1.0.1-beta.1

Weekly downloads
1
License
ISC
Repository
-
Last release
4 years ago

Install

npm i @lx/react-typewriter-hook --save

Usage

// 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 = useTypewrite(word, {
    duration: 1000,
    // etc
  })
  return typing
}
OptionTypeDescriptionDefault Value
intervalnumberThe interval between each 'stroke' of a letter, in milliseconds. Overidden by duration if presentA random number
durationnumberThe total duration to spend typing, in milliseconds. If provided, the duration is evenly divided between the total number of letters in the provided string. Overrides interval