react-simple-typewriter
react-simple-typewriter copied to clipboard
How to randomize words order?
I have the array of facts and every time the typing is done i want new fact, how to achieve that?
const pickRandomString = () => {
let random = Math.floor(Math.random() * facts.length);
console.log(facts[random])
return [facts[random]];
}
const [text, flags] = useTypewriter({
words: pickRandomString(),
loop: false,
typeSpeed: 50,
deleteSpeed: 40,
//onLoopDone: () => console.log("done from typewriter hook")
});