From 9236a2e29d33a707cd3d63b1948e1865a0f1f232 Mon Sep 17 00:00:00 2001 From: ymekuria Date: Thu, 26 Sep 2024 23:52:25 -0700 Subject: [PATCH] feat(04-zkapp-ui-with-react.mdx): add defining state example --- docs/zkapps/tutorials/04-zkapp-ui-with-react.mdx | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/docs/zkapps/tutorials/04-zkapp-ui-with-react.mdx b/docs/zkapps/tutorials/04-zkapp-ui-with-react.mdx index ba4c60efc..882d5996c 100644 --- a/docs/zkapps/tutorials/04-zkapp-ui-with-react.mdx +++ b/docs/zkapps/tutorials/04-zkapp-ui-with-react.mdx @@ -180,7 +180,16 @@ The example project has a completed app. The `page.tsx` file is the entry file f The web worker code resides in the `04-zkapp-browser-ui/ui/app/zkappWorker.ts` file. Here, you define the functions that will be executed in the worker thread. +#### Defining State +The state object holds references to the zkAppInstance, AddInstance, transactions, and other necessary components. +```ts ignore + const state = { + Add: null as null | typeof Add, + zkapp: null as null | Add, + transaction: null as null | Transaction, + }; + ``` ### Environment configuration