From 44437b79f95d9b89ccda4d64eda198a5bd096329 Mon Sep 17 00:00:00 2001 From: sdegutis Date: Fri, 30 Aug 2024 12:29:02 -0500 Subject: [PATCH] Better examples. --- site/unity/index.html | 2 +- site/unity/samplecode.jsx | 6 +++--- site/unity/vanillajsx.ts | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/site/unity/index.html b/site/unity/index.html index 5304823..3d8add8 100644 --- a/site/unity/index.html +++ b/site/unity/index.html @@ -4,7 +4,7 @@ - The future of JSX + Proposal for standardized JSX diff --git a/site/unity/samplecode.jsx b/site/unity/samplecode.jsx index 75323f6..a19e5c7 100644 --- a/site/unity/samplecode.jsx +++ b/site/unity/samplecode.jsx @@ -1,11 +1,11 @@ // live playground -const b1 = Click me; +const b1 = Click me; -const b2 = ; +const b2 = ; const b3 =
; function Button(attrs, children) { - return <>{children}; + return <>Button title: {...children}.; } diff --git a/site/unity/vanillajsx.ts b/site/unity/vanillajsx.ts index 460b1f0..a3bf1b2 100644 --- a/site/unity/vanillajsx.ts +++ b/site/unity/vanillajsx.ts @@ -51,7 +51,7 @@ export const babelPluginVanillaJSX: babel.PluginItem = { else if (attr.value.type === 'StringLiteral') val = t.stringLiteral(attr.value.value); else if (attr.value.type === 'JSXElement') val = attr.value; else if (attr.value.type === 'JSXFragment') val = attr.value; - else if (attr.value.expression.type === 'JSXEmptyExpression') throw new Error(); + else if (attr.value.expression.type === 'JSXEmptyExpression') throw new Error('impossible?'); else val = attr.value.expression; return t.objectProperty(name, val);