Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why does it delete the text?? #214

Open
bennyschmidt opened this issue Feb 12, 2024 · 0 comments
Open

Why does it delete the text?? #214

bennyschmidt opened this issue Feb 12, 2024 · 0 comments

Comments

@bennyschmidt
Copy link

bennyschmidt commented Feb 12, 2024

Possible duplicate: #162

This is a cool library, but why on earth does it delete the text the moment after it renders?

I can't find an option to make the text simply render without it deleting afterwards.


Edit: I found a solution. Basically, manage your array of strings yourself in React, and you can pass a single string to strings - it doesn't have to be an array.

These will all auto-delete after rendering for some reason:

          <Typewriter
            options={{
              strings: [text]
            }}
          />
          <Typewriter
            options={{
              strings: [text, ""]
            }}
          />
          <Typewriter
            options={{
              strings: [text1, text2, text3]
            }}
          />

But this works:

          <Typewriter
            options={{
              strings: text
            }}
          />

just manage the state of text in React, and pass the currently rendered string directly (not in an array)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant