From 3e60236710b86de2fbd24462f9bade823771e8fb Mon Sep 17 00:00:00 2001 From: ake123 Date: Tue, 16 Jan 2024 14:12:11 +0200 Subject: [PATCH] some upgrade --- package-lock.json | 6 +++--- package.json | 4 ++-- src/component/Product.jsx | 4 ++++ 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/package-lock.json b/package-lock.json index 9f56ab75..dccbc05f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -3661,9 +3661,9 @@ } }, "caniuse-lite": { - "version": "1.0.30001342", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001342.tgz", - "integrity": "sha512-bn6sOCu7L7jcbBbyNhLg0qzXdJ/PMbybZTH/BA6Roet9wxYRm6Tr9D0s0uhLkOZ6MSG+QU6txUgdpr3MXIVqjA==" + "version": "1.0.30001577", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001577.tgz", + "integrity": "sha512-rs2ZygrG1PNXMfmncM0B5H1hndY5ZCC9b5TkFaVNfZ+AUlyqcMyVIQtc3fsezi0NUCk5XZfDf9WS6WxMxnfdrg==" }, "case-sensitive-paths-webpack-plugin": { "version": "2.4.0", diff --git a/package.json b/package.json index 0e59b195..dcc26d70 100644 --- a/package.json +++ b/package.json @@ -19,8 +19,8 @@ "web-vitals": "^2.1.4" }, "scripts": { - "predeploy":"npm run build", - "deploy":"gh-pages-d build", + "predeploy": "npm run build", + "deploy": "gh-pages-d build", "start": "react-scripts start", "build": "react-scripts build", "test": "react-scripts test", diff --git a/src/component/Product.jsx b/src/component/Product.jsx index 50d7ac16..5c1c9da6 100644 --- a/src/component/Product.jsx +++ b/src/component/Product.jsx @@ -9,6 +9,7 @@ const Product = () => { const [loading, setLoading] = useState(false); useEffect(() => { + let componentMounted = true; const getProduct = async () => { setLoading(true); const response = await fetch(`https://fakestoreapi.com/products/${id}`); @@ -16,6 +17,9 @@ const Product = () => { setLoading(false); }; getProduct(); + return () => { + componentMounted = false; + }; }, []); const Loading = () => {