UNPKG

warpvas

Version:

This JavaScript library enables fast and efficient image distortion transformations using Canvas 2D.

20 lines (14 loc) 424 B
import { useCallback, useEffect, useState } from 'react'; const useMarkDown = (path: string) => { const [content, setContent] = useState<string>(''); const loadFile = useCallback(() => { fetch(path) .then((response) => response.text()) .then((text) => { setContent(text); }); }, []); useEffect(loadFile, []); return [content, setContent] as const; }; export default useMarkDown;