perf: md引入;docker-compose;

This commit is contained in:
archer
2023-04-09 22:56:08 +08:00
parent 5e4c4dd79b
commit 99e5fbd0f5
17 changed files with 185 additions and 149 deletions

15
src/hooks/useMarkdown.ts Normal file
View File

@@ -0,0 +1,15 @@
import { useQuery } from '@tanstack/react-query';
export const getMd = async (url: string) => {
const response = await fetch(`/docs/${url}`);
const textContent = await response.text();
return textContent;
};
export const useMarkdown = ({ url }: { url: string }) => {
const { data = '' } = useQuery([url], () => getMd(url));
return {
data
};
};