diff --git a/blog/2024-11-15-playing-with-fire/1-introduction/Gasket.tsx b/blog/2024-11-15-playing-with-fire/1-introduction/Gasket.tsx new file mode 100644 index 0000000..1b96395 --- /dev/null +++ b/blog/2024-11-15-playing-with-fire/1-introduction/Gasket.tsx @@ -0,0 +1,16 @@ +import Canvas, {PainterContext} from "../src/Canvas"; +import {useContext} from "react"; + +export function Render({f}) { + const {setPainter} = useContext(PainterContext); + setPainter(f); + return <>; +} + +export default function Gasket({f}) { + return ( + + + + ) +} \ No newline at end of file diff --git a/blog/2024-11-15-playing-with-fire/1-introduction/chaosGame.js b/blog/2024-11-15-playing-with-fire/1-introduction/chaosGame.js index a3e6ce0..2644edf 100644 --- a/blog/2024-11-15-playing-with-fire/1-introduction/chaosGame.js +++ b/blog/2024-11-15-playing-with-fire/1-introduction/chaosGame.js @@ -27,10 +27,4 @@ function* chaosGame() { } // Wiring so the code above displays properly -function Gasket() { - const {setPainter} = useContext(PainterContext); - setPainter(chaosGame()); - - return (<>) -} -render() +render() diff --git a/blog/2024-11-15-playing-with-fire/1-introduction/index.mdx b/blog/2024-11-15-playing-with-fire/1-introduction/index.mdx index c4f1890..eb904cf 100644 --- a/blog/2024-11-15-playing-with-fire/1-introduction/index.mdx +++ b/blog/2024-11-15-playing-with-fire/1-introduction/index.mdx @@ -177,9 +177,7 @@ import Scope from './scope' import chaosGameSource from '!!raw-loader!./chaosGame' -
diff --git a/blog/2024-11-15-playing-with-fire/1-introduction/scope.tsx b/blog/2024-11-15-playing-with-fire/1-introduction/scope.tsx index 4ffe6d4..dc05043 100644 --- a/blog/2024-11-15-playing-with-fire/1-introduction/scope.tsx +++ b/blog/2024-11-15-playing-with-fire/1-introduction/scope.tsx @@ -1,15 +1,12 @@ -import {useContext} from "react"; +import Gasket from "./Gasket"; import { plot } from './plot'; import { randomBiUnit } from '../src/randomBiUnit'; import { randomInteger } from '../src/randomInteger'; -import Canvas, {PainterContext} from "../src/Canvas"; const Scope = { - Canvas, - PainterContext, + Gasket, plot, randomBiUnit, randomInteger, - useContext, } export default Scope; \ No newline at end of file