react-simple-typewriter
react-simple-typewriter copied to clipboard
hidding the cursor after a map item has been rendered.
Hello guys. I hope you are all doing well.
i would like to know if there is a short hand for disabling the cursor for a mapped component after the loop is done.
i have tried the onLoopDone function provided, but this won't work if the the typewriter is nested inside a continuously updating component.
For example,
const [cursorOn,setCursorOn] = useState(true)
message.map(item=>{
return(
<Typewriter cursor={cursorOn} onLoopDone={()=>setCursorOn(false)}>{item}</Typewriter>
)})
i thought of creating a cursor on off state for each component inside a map, but i hope there is an easier way that the cursor will be automatically disabled after the loop has been completed.
Apperciate it.