From 9ed1da8168bdde29c376545b47a5319990b3aef6 Mon Sep 17 00:00:00 2001 From: Oliver He Date: Tue, 26 Sep 2023 09:30:42 -0700 Subject: [PATCH] [Doc] Update build e2e dapp docs (#10165) * Update build e2e dapp docs * update js -> jsx * update * Update developer-docs-site/docs/tutorials/build-e2e-dapp/4-fetch-data-from-chain.md * f * f --------- Co-authored-by: David Wolinsky --- .../build-e2e-dapp/4-fetch-data-from-chain.md | 15 ++++++++++----- developer-docs-site/scripts/additional_dict.txt | 9 +++++++++ 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/developer-docs-site/docs/tutorials/build-e2e-dapp/4-fetch-data-from-chain.md b/developer-docs-site/docs/tutorials/build-e2e-dapp/4-fetch-data-from-chain.md index 7feb0c96d1704..5ccf8c4298480 100644 --- a/developer-docs-site/docs/tutorials/build-e2e-dapp/4-fetch-data-from-chain.md +++ b/developer-docs-site/docs/tutorials/build-e2e-dapp/4-fetch-data-from-chain.md @@ -57,7 +57,12 @@ function App ( The `account` object is `null` if there is no account connected; when an account is connected, the `account` object holds the account information, including the account address. 3. Next, we want to fetch the account’s TodoList resource. - Begin by importing `useEffect` by using `jsx import useEffect from "react"; ` + Begin by importing `useEffect` by adding: + +```jsx +import { useEffect } from "react"; +``` + Let’s add a `useEffect` hook to our file that would call a function to fetch the resource whenever our account address changes: ```jsx @@ -70,17 +75,17 @@ function App() { } ``` -4. Before creating our `fetchList` function, let’s also create a local state to store whether the account has a list: +4. Before creating our `fetchList` function, let’s also create a local state to store whether the account has a list. + Import `useState` by using ```import { useState, useEffect } from "react"; ``` + Next create a state variable `accountHasList` and its setter `setAccountHasList` -```js +```jsx function App ( ... const [accountHasList, setAccountHasList] = useState(false); ... ) ``` -also import `useEffect` using -```import { useState, useEffect } from "react"; ``` 5. Our `useEffect` hook is calling a `fetchList` function; let’s create it: diff --git a/developer-docs-site/scripts/additional_dict.txt b/developer-docs-site/scripts/additional_dict.txt index b9032ea48ec7e..9f159242d7541 100644 --- a/developer-docs-site/scripts/additional_dict.txt +++ b/developer-docs-site/scripts/additional_dict.txt @@ -339,6 +339,8 @@ accessors accountHasList acount addr +ae +af ait allowfullscreen allowlist @@ -351,6 +353,7 @@ aptoslabs arity arweave asia +async atomicity auth authenticator @@ -399,6 +402,7 @@ dapp dapp's dapps data's +dbab de deallocate debuggability @@ -433,6 +437,7 @@ enums extensibility failover faq +fdaefc fetchList filesystem findable @@ -446,6 +451,7 @@ fungibility gcloud gcp gcs +getAccountResource getAddressByName getPrimaryNameByAddress groth @@ -505,6 +511,7 @@ mempool mempools merkle mintAptosName +moduleAddress monorepo multinode multisig @@ -598,6 +605,7 @@ subtyping superset svg synchronizer +TodoListResource terraform testnet th @@ -649,6 +657,7 @@ waypoint webapp whitepaper withdrawable +xcbddf xFD xlarge yaml