In my React project I'm using Typewriter
package.
It has method changeDelay
, that doesn't actually work.
Here is an example number 1:
<Typewriter
onInit={(typewriter) => {
typewriter.typeString('Some text').changeDelay(1).start();
}}
/>
In this case it should print text permanently, but it doesn't.
Here is example number 2. It works fine, I can change delay.
<Typewriter
options={{
strings: ['Some .'],
delay: 80,
autoStart: true,
loop: true
}}
/>
So, I have 2 questions.
- For first example, is how I can actually change delay speed?
OR
- For second example, is how I can prevent it from deleting text? (removing
autoStart
or/andloop
doesn't work)
CodePudding user response:
For the first the case, you can use prop options
in order to change the delay:
import React from 'react';
import Typewriter from 'typewriter-effect';
import './style.css';
export default function App() {
return (
<Typewriter
onInit={(typewriter) => {
typewriter.typeString('Some text').changeDelay(1).start();
}}
options={{
delay: 100,
}}
/>
);
}