summaryrefslogtreecommitdiff
path: root/docs/src
diff options
context:
space:
mode:
authorGravatar Knniff <f.kalvelage@posteo.de> 2021-09-24 01:23:35 +0000
committerGravatar GitHub <noreply@github.com> 2021-09-23 20:23:35 -0500
commit0012a0154132b3e60b65bb57e38a4383141fb816 (patch)
treead58019fe7157a5675c305ac0e75aa387881f6fa /docs/src
parent63ca3df3cad799108edac2dfd106103373cc30dc (diff)
downloadastro-0012a0154132b3e60b65bb57e38a4383141fb816.tar.gz
astro-0012a0154132b3e60b65bb57e38a4383141fb816.tar.zst
astro-0012a0154132b3e60b65bb57e38a4383141fb816.zip
📘 DOC: show how to pass props (#1381)
* show how to pass props In the current documentation it is only shown how to receive props but not how to pass a component said props. This adds a bit of code which shows how to pass props to a component. * Update docs/src/pages/core-concepts/astro-components.md Co-authored-by: Caleb Jasik <calebjasik@jasik.xyz>
Diffstat (limited to 'docs/src')
-rw-r--r--docs/src/pages/core-concepts/astro-components.md11
1 files changed, 11 insertions, 0 deletions
diff --git a/docs/src/pages/core-concepts/astro-components.md b/docs/src/pages/core-concepts/astro-components.md
index 1fe96646b..f85e9f138 100644
--- a/docs/src/pages/core-concepts/astro-components.md
+++ b/docs/src/pages/core-concepts/astro-components.md
@@ -184,6 +184,17 @@ const { greeting = 'Hello', name } = Astro.props;
</div>
```
+You can then pass the component props like this:
+
+```astro
+---
+// SomeOtherComponent.astro
+import SomeComponent from "./SomeComponent.astro";
+let firstName = "world!";
+---
+<SomeComponent name={firstName}/>
+```
+
### Slots
`.astro` files use the [`<slot>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/slot) tag to enable component composition. Coming from React or Preact, this is the same concept as `children`. You can think of the `<slot>` element as a placeholder for markup which will be passed in from outside of the component.
lass='insertions'>+16 2023-10-16Fix `toHaveBeenCalled` having wrong error signatureGravatar Ashcon Partovi 1-2/+2 2023-10-16Fix formattingGravatar Ashcon Partovi 1-2/+1 2023-10-16Add `reusePort` to `Bun.serve` typesGravatar Ashcon Partovi 1-0/+9 2023-10-16Fix `request.url` having incorrect portGravatar Ashcon Partovi 4-1/+92 2023-10-16Remove uWebSockets header from Bun.serve responsesGravatar Ashcon Partovi 1-6/+6 2023-10-16Rename some testsGravatar Ashcon Partovi 3-0/+0 2023-10-16Fix #6467Gravatar Ashcon Partovi 2-3/+10 2023-10-16Update InternalModuleRegistryConstants.hGravatar Dylan Conway 1-3/+3 2023-10-16Development -> Contributing (#6538)Gravatar Colin McDonnell 2-1/+1 2023-10-14fix(net/tls) fix pg hang on end + hanging on query (#6487)Gravatar Ciro Spaciari 3-8/+36 2023-10-13fix installing dependencies that match workspace versions (#6494)Gravatar Dylan Conway 4-2/+64 2023-10-13fix lockfile struct padding (#6495)Gravatar Dylan Conway 3-3/+18