Crypto Prices Flashcards

1
Q

Property to add to table header?

A

scope=”col”

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What does scope=”col” do?

A

Added for accessibility used for header <th> elements to indicate that all cells below this column relate to it.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is the outline of the table?

A

<table>
<caption>Crypto Prices</caption>
<thead>
<tr>
<th>Coin</th>
<th>Price</th>
<th>Market Cap</th>
</tr>
</thead>

<tbody>
<tr>
<th>Bitcoin</th>
<td>$29,970.48</td>
<td>$57,108,740,782</td>
</tr>
</tbody>
</table>

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Explain different functionality with how errors are handled with and without try/catch

A

With a try/catch, the error will not cause the script to stop executing.

If no catch, the error will be logged to the console by default and script will stop executing.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Do you need catch with a try?

A

No, but if you don’t have catch, you will need a finally block.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What property do you need to pass jsx elements in a loop?

A

the “key” prop, with a unique value.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What value should you use to disable the next and back buttons?

A

You should use hasPrev and hasNext from the api. If hasPrev is not available, the use page === 0. If hasNext is not available then use the page and limit to calculate if you are on the last page.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What state is needed for CryptoPrices?

A

const [page, setPage] = useState(0);
const [cryptoData, setCryptoData] = useState({});

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What does the useEffect look like?

A

useEffect(() => {
const fetchCrypto = async () => {
try {
const res = await fetch(${api}?page=${page});
const json = await res.json();

  setCryptoData(json);
catch (e) {
 // Display error to the user
  console.log('Error', e);
}   }

fetchCrypto();
}, [page]);

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly