From 973751e31b52c301ff21ba17b120d9e488614a45 Mon Sep 17 00:00:00 2001 From: Zade Viggers <74938858+zadeviggers@users.noreply.github.com> Date: Tue, 11 Jan 2022 11:17:07 +1300 Subject: [PATCH] Note that Astro also supports `` syntax (#2354) --- .../en/core-concepts/astro-components.md | 34 ++++++++++--------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/docs/src/pages/en/core-concepts/astro-components.md b/docs/src/pages/en/core-concepts/astro-components.md index 0c7f6d71a..629ae74e6 100644 --- a/docs/src/pages/en/core-concepts/astro-components.md +++ b/docs/src/pages/en/core-concepts/astro-components.md @@ -275,6 +275,8 @@ When working inside a JSX expression, however, you must wrap multiple elements i A Fragment must open with `<>` and close with ``. Don't worry if you forget this, Astro's compiler will warn you that you need to add one. +> **Note:** Astro also supports opening a fragment with `` and closing it with `` if you prefer to use that syntax. + ```astro --- const items = ["Dog", "Cat", "Platipus"]; @@ -327,22 +329,22 @@ import TwitterTimeline from '../components/TwitterTimeline.astro'; `.astro` files can end up looking very similar to `.jsx` files, but there are a few key differences. Here's a comparison between the two formats. -| Feature | Astro | JSX | -| ---------------------------- | ------------------------------------------ | -------------------------------------------------- | -| File extension | `.astro` | `.jsx` or `.tsx` | -| User-Defined Components | `` | `` | -| Expression Syntax | `{}` | `{}` | -| Spread Attributes | `{...props}` | `{...props}` | -| Boolean Attributes | `autocomplete` === `autocomplete={true}` | `autocomplete` === `autocomplete={true}` | -| Inline Functions | `{items.map(item =>
  • {item}
  • )}` | `{items.map(item =>
  • {item}
  • )}` | -| IDE Support | WIP - [VS Code][code-ext] | Phenomenal | -| Requires JS import | No | Yes, `jsxPragma` (`React` or `h`) must be in scope | -| Fragments | Automatic top-level, `<>` inside functions | Wrap with `` or `<>` | -| Multiple frameworks per-file | Yes | No | -| Modifying `` | Just use `` | Per-framework (``, ``, etc) | -| Comment Style | `` | `{/_ JavaScript _/} | -| Special Characters | ` ` | ` ` | -| Attributes | `dash-case` | `camelCase` | +| Feature | Astro | JSX | +| ---------------------------- | ---------------------------------------------------------- | -------------------------------------------------- | +| File extension | `.astro` | `.jsx` or `.tsx` | +| User-Defined Components | `` | `` | +| Expression Syntax | `{}` | `{}` | +| Spread Attributes | `{...props}` | `{...props}` | +| Boolean Attributes | `autocomplete` === `autocomplete={true}` | `autocomplete` === `autocomplete={true}` | +| Inline Functions | `{items.map(item =>
  • {item}
  • )}` | `{items.map(item =>
  • {item}
  • )}` | +| IDE Support | WIP - [VS Code][code-ext] | Phenomenal | +| Requires JS import | No | Yes, `jsxPragma` (`React` or `h`) must be in scope | +| Fragments | Automatic top-level, `` or `<>` inside functions | Wrap with `` or `<>` | +| Multiple frameworks per-file | Yes | No | +| Modifying `` | Just use `` | Per-framework (``, ``, etc) | +| Comment Style | `` | `{/_ JavaScript _/} | +| Special Characters | ` ` | ` ` | +| Attributes | `dash-case` | `camelCase` | ## URL resolution