A React component that animates text to make it appear as if it's being written by ChatGPT.
- Install the package:
npm install write-like-chat-gpt
. - Import the component:
import WriteLikeChatGPT from 'write-like-chat-gpt'
. - Use the component in your code:
<WriteLikeChatGPT text="Hello, world!" />
text
: the text to animate (required)
import React from 'react'; import WriteLikeChatGPT from 'write-like-chat-gpt';
const MyComponent = () => { return ( <div> <WriteLikeChatGPT text="Hello, world!" /> </div> ); };
export default MyComponent;
This component uses the following React hooks:
useState
useEffect
useMemo
useLayoutEffect
useRef
It also uses the requestAnimationFrame
function to animate the text.