Skip to content

Commit

Permalink
Updates intance id doc
Browse files Browse the repository at this point in the history
  • Loading branch information
kj committed Nov 18, 2023
1 parent 153a99c commit 929529b
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion app/docs/md/elements/state/instance-id.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
title: Instance ID
---

`instanceID` is a unique identifier that is generated per Custom Element instance. This enables you to differentiate between multiple instances of the same element on a page. It can also be useful when using a string based diffing library like [Morphdom](https://github.com/patrick-steele-idem/morphdom) that require unique identifiers for DOM diffing.
`instanceID` is a unique identifier that is generated per Custom Element instance. This enables you to differentiate between multiple instances of the same element on a page. It can also be useful when using a string based diffing library like [Morphdom](https://github.com/patrick-steele-idem/morphdom) which keys on unique identifiers to know when to update versus replace an element.

```javascript
export default function MyCard({ html, state }) {
Expand All @@ -17,3 +17,7 @@ export default function MyCard({ html, state }) {
`
}
```

<doc-callout mark="ℹ️">
Pro tip: As in the example above, prefix the id with the element name in order to use the id with multiple child elements.
</doc-callout>

0 comments on commit 929529b

Please sign in to comment.