18 |
{product.name}
19 |
{product.description}
20 |
${product.price}
21 |
22 |
34 |
35 |
36 |
46 |
47 |
48 | Go Back
49 |
50 |

51 |
52 | );
53 | }
54 |
--------------------------------------------------------------------------------
/src/ErrorBoundary.jsx:
--------------------------------------------------------------------------------
1 | import React from "react";
2 |
3 | export default class ErrorBoundary extends React.Component {
4 | state = { hasError: false };
5 |
6 | static getDerivedStateFromError(error) {
7 | return { hasError: true };
8 | }
9 |
10 | render() {
11 | return this.state.hasError ? (
12 |