Skip to content

Commit 7daad96

Browse files
[docs] add exactly how a property expression behaves imperatively (#1204)
1 parent 79c3407 commit 7daad96

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

packages/lit-dev-content/site/docs/v2/templates/expressions.md

+7-1
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,13 @@ You can set a JavaScript property on an element using the `.` prefix and the pro
287287
html`<input .value=${this.itemCount}>`;
288288
```
289289

290-
You can use this syntax to pass complex data down the tree to subcomponents. For example, if you have a `my-list` component with a `listItems` property, you could pass it an array of objects:
290+
The behavior of the code above is the same as directly setting the `value` property on the `input` element, e.g.:
291+
292+
```js
293+
inputEl.value = this.itemCount;
294+
```
295+
296+
You can use the property expression syntax to pass complex data down the tree to subcomponents. For example, if you have a `my-list` component with a `listItems` property, you could pass it an array of objects:
291297

292298
```js
293299
html`<my-list .listItems=${this.items}></my-list>`;

packages/lit-dev-content/site/docs/v3/templates/expressions.md

+7-1
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,13 @@ You can set a JavaScript property on an element using the `.` prefix and the pro
287287
html`<input .value=${this.itemCount}>`;
288288
```
289289

290-
You can use this syntax to pass complex data down the tree to subcomponents. For example, if you have a `my-list` component with a `listItems` property, you could pass it an array of objects:
290+
The behavior of the code above is the same as directly setting the `value` property on the `input` element, e.g.:
291+
292+
```js
293+
inputEl.value = this.itemCount;
294+
```
295+
296+
You can use the property expression syntax to pass complex data down the tree to subcomponents. For example, if you have a `my-list` component with a `listItems` property, you could pass it an array of objects:
291297

292298
```js
293299
html`<my-list .listItems=${this.items}></my-list>`;

0 commit comments

Comments
 (0)