mirror of
https://github.com/bspeice/speice.io
synced 2024-12-22 16:48:10 -05:00
21 lines
527 B
TypeScript
21 lines
527 B
TypeScript
import {SquareCanvas, PainterContext} from "../src/Canvas";
|
|
import {useContext, useEffect} from "react";
|
|
|
|
export function Render({f}) {
|
|
const {width, height, setPainter} = useContext(PainterContext);
|
|
useEffect(() => {
|
|
if (width && height) {
|
|
const painter = f({width, height});
|
|
setPainter(painter);
|
|
}
|
|
}, [width, height]);
|
|
return <></>;
|
|
}
|
|
|
|
export default function Gasket({f}) {
|
|
return (
|
|
<SquareCanvas>
|
|
<Render f={f}/>
|
|
</SquareCanvas>
|
|
)
|
|
} |