typeit-react icon indicating copy to clipboard operation
typeit-react copied to clipboard

Reset is not resetting strings

Open RilDev opened this issue 4 years ago • 2 comments

Hi @alexmacarthur,

I'm trying to do a multilingual website with a cool animated title (with typeit-react!).

But when I change the state of the TypeIt component, it retypes the previous values as well and chains them!

typeit-react-reset-string-issue

Here is the minimal bug reproduction: https://codesandbox.io/s/peaceful-sunset-i2eve?file=/src/App.js

Or maybe there is a smarter way to build this.

RilDev avatar Aug 13 '20 14:08 RilDev

Turns out, I found a work-around. I simply display the type-it component only on the first render and then display then display plain text: https://codesandbox.io/s/gifted-galois-5gndv?file=/src/App.js

typeit-react-reset-string-issue-work-around

Here is the result in action: https://codeforfaith.com/

RilDev avatar Aug 16 '20 14:08 RilDev

@rildev Thanks for reporting that issue and glad you found a workaround! I haven't had a chance to dig into anything myself yet, but will bump a version if needed when I have some time.

alexmacarthur avatar Aug 16 '20 16:08 alexmacarthur