From 7fd4d3827c0f1bf5b198d2a90102ea7c692eadc8 Mon Sep 17 00:00:00 2001 From: EmNudge Date: Fri, 25 Dec 2020 11:21:22 -0500 Subject: [PATCH] clarified readonly prop access Was personally unaware how readonly props can be accessed until I found [this stackoverflow answer](https://stackoverflow.com/questions/58287729/how-can-i-export-a-function-from-a-svelte-component-that-changes-a-value-in-the) through some googling recently. Does not seem to be mentioned anywhere in the docs. --- site/content/docs/01-component-format.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/site/content/docs/01-component-format.md b/site/content/docs/01-component-format.md index 09451701a0..3642509da8 100644 --- a/site/content/docs/01-component-format.md +++ b/site/content/docs/01-component-format.md @@ -57,6 +57,8 @@ In development mode (see the [compiler options](docs#svelte_compile)), a warning If you export a `const`, `class` or `function`, it is readonly from outside the component. Function *expressions* are valid props, however. +Readonly props can be accessed as properties on the element, tied to the component using [`bind:this` syntax](docs#bind_element). + ```sv