mtverse
Components
Cards
AI Code Copilot
Unlock
Home
Preview
Raw code
Docs
src/hooks/use-project.ts
Run
use-project.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import { useEffect, useState } from "react"; export function useProject(projectId: string) { const [project, setProject] = useState(null); const [loading, setLoading] = useState(true); useEffect(() => { fetch("/api/projects/" + projectId) .then((response) => response.json()) .then((data) => { setProject(data); setLoading(false); }); }, []); return { project, loading }; }
terminal
problems
1
tests
➜
npm run dev
ready - local server running on http://localhost:3000