this repo has no description
at main 12 lines 308 B view raw
1import { useEffect, useState } from 'preact/hooks'; 2 3function AsyncText({ children }) { 4 if (typeof children === 'string') return children; 5 const [text, setText] = useState(''); 6 useEffect(() => { 7 Promise.resolve(children).then(setText); 8 }, [children]); 9 return text; 10} 11 12export default AsyncText;