Skip to content

Commit

Permalink
[Doc] Update build e2e dapp docs (#10165)
Browse files Browse the repository at this point in the history
* 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 <isaac.wolinsky@gmail.com>
  • Loading branch information
heliuchuan and davidiw authored Sep 26, 2023
1 parent a2374a5 commit 9ed1da8
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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<boolean>(false);
...
)
```
also import `useEffect` using
```import { useState, useEffect } from "react"; ```

5. Our `useEffect` hook is calling a `fetchList` function; let’s create it:

Expand Down
9 changes: 9 additions & 0 deletions developer-docs-site/scripts/additional_dict.txt
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,8 @@ accessors
accountHasList
acount
addr
ae
af
ait
allowfullscreen
allowlist
Expand All @@ -351,6 +353,7 @@ aptoslabs
arity
arweave
asia
async
atomicity
auth
authenticator
Expand Down Expand Up @@ -399,6 +402,7 @@ dapp
dapp's
dapps
data's
dbab
de
deallocate
debuggability
Expand Down Expand Up @@ -433,6 +437,7 @@ enums
extensibility
failover
faq
fdaefc
fetchList
filesystem
findable
Expand All @@ -446,6 +451,7 @@ fungibility
gcloud
gcp
gcs
getAccountResource
getAddressByName
getPrimaryNameByAddress
groth
Expand Down Expand Up @@ -505,6 +511,7 @@ mempool
mempools
merkle
mintAptosName
moduleAddress
monorepo
multinode
multisig
Expand Down Expand Up @@ -598,6 +605,7 @@ subtyping
superset
svg
synchronizer
TodoListResource
terraform
testnet
th
Expand Down Expand Up @@ -649,6 +657,7 @@ waypoint
webapp
whitepaper
withdrawable
xcbddf
xFD
xlarge
yaml
Expand Down

0 comments on commit 9ed1da8

Please sign in to comment.