Also called Text Generate Effect, A Typewriter Effect is something where a piece of text constructs itself with some milliseconds in delay. You will see the text getting generated from start to finish. In this problem, create a Typewriter Effect from scratch using native React and/or Javascript functions.
Take a look at the example below
Start Generating
button, the sample
text should start printing word by word.10 milliseconds
while adding the keywords.Reset
button should reset the window to its initial state.div
element to make a container as well.Start Generating
- clicking on it should DO NOTHING, Until and unless the user clicks on Reset
- they can they be able to re-run the effect.memory leaks
inside of your application.Click to reveal
Can you try using setInterval()
to loop through the sampleCode
string, where you generate the code by appending one character at a time?
Click to reveal
Try using a useEffect()
hook to call your creation
method for creating the text string. This will help you to implement one-time-generate
so that the user has to reset everytime they try to create multiple times.