From d9cbbcace7fa3e641b464e7ea2ca2aa410038997 Mon Sep 17 00:00:00 2001 From: kj Date: Fri, 17 Nov 2023 13:36:45 -0800 Subject: [PATCH] Adds entries for context and instanceID --- app/docs/md/elements/state/index.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/docs/md/elements/state/index.md b/app/docs/md/elements/state/index.md index dedcd464..bddc2629 100644 --- a/app/docs/md/elements/state/index.md +++ b/app/docs/md/elements/state/index.md @@ -38,10 +38,12 @@ export default function MyElement ({ html, state }) { -The state object contains two top level entries: +The state object contains four top level entries: - `attrs`, which contains all the key value pairs of attributes passed into your custom element’s instance - `store`, which contains the global state of your Enhance application +- `instanceID`, which is a unique ID per instance of Custom Element +- `context`, which is an Object that can be used to pass state to child elements to avoid prop drilling. These two different entries allow you to work with both basic and complex state in powerful ways without the need for complex abstractions or third party libraries.