Skip to content

How to randomize words order? #18

@GitMalmoer

Description

@GitMalmoer

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")
  });

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions