git.iko.soy/rowtype-yoga/psfp
on c810fc0 help sign in
20 lines 590 B history raw
1import React, { useEffect, useState } from "react";
2const yogaCard = require("./YogaCard.purs");
3const fetch = typeof window !== "undefined" && window.fetch;
5const Code = ({ codeString, language, ...props }) => {
6 const [Editor, setEditor] = useState(null);
7 console.log("stuff", props);
8 useEffect(() => {
9 if (Editor === null) {
10 const Eddy = yogaCard.mkEditor(fetch)();
11 setEditor(prev => console.log("Prev", prev) || Eddy);
12 }
13 }, []);
15 return (
16 Editor !== null ? <Editor height="300px" initialCode={codeString}></Editor> : ""
17 );
18};
20export default Code;