import useSWR from "swr"; import ReactMarkdown from "react-markdown"; const fetcher = (...args) => fetch(...args).then((res) => res.json()); const LessonContainer = ({ name }) => { const { data, error, isLoading } = useSWR( `/api/lesson?name=${name}`, fetcher ); return ( <>

Lesson about {name}

{!isLoading && !error && {data.contents}} ); }; export default LessonContainer;