Description
Initial checklist
- I read the support docs
- I read the contributing guide
- I agree to follow the code of conduct
- I searched issues and discussions and couldn’t find anything (or linked relevant results below)
Problem
Hi, I'm the developer of react-markdown-typewriter a library that adds elements that give the possibility to animate each letter of the markdown component, by default, to create a typewriter animation. the animations are created with motion.
For now I have created the variants for the Markdown and MarkdownAsync components.
I'm trying to create the variant for MarkdownHooks too.
Roughly how it works is the following, a parent component (motion) starts the animation of each child (Markdown elements) every n milliseconds. the animation must be triggered by an event for example during the first render.
With MarkdownHooks if I trigger the animation during the first render it will be executed on the fallback element and not when the MarkdownHooks element has finished loading.
So I would need a function (onComplete) that warns me that the MarkdownHooks loading is finished and then triggers the animation.
Current solutions
I've currently solved it this way, although it can't be considered a solution 😒
useEffect(() => {
setTimeout(() => {
// start animation
}, 10);
}, [text]);
Proposed solutions
add a function that is launched when markdown loading is finished
<MarkdownHooks
onComplete={() => {
// start animation
}}
>
{text}
</MarkdownHooks>