diff --git a/hello-world/next/README.md b/hello-world/next/README.md index f93504e5..8f5f8ad0 100644 --- a/hello-world/next/README.md +++ b/hello-world/next/README.md @@ -259,7 +259,7 @@ function ImageCapture() { let pCvRouter: MutableRefObject | null> = useRef(null); let isDestroyed = useRef(false); - const decodeImg = async (e: React.ChangeEvent) => { + const captureImage = useCallback(async (e: React.ChangeEvent) => { let files = [...(e.target.files as any as File[])]; e.target.value = ""; // reset input resultsContainer.current!.innerText = ""; @@ -314,7 +314,7 @@ function ImageCapture() { return (
- +
diff --git a/hello-world/next/components/ImageCapture/ImageCapture.tsx b/hello-world/next/components/ImageCapture/ImageCapture.tsx index c6e4f9b2..934c13fe 100644 --- a/hello-world/next/components/ImageCapture/ImageCapture.tsx +++ b/hello-world/next/components/ImageCapture/ImageCapture.tsx @@ -11,7 +11,7 @@ function ImageCapture() { let pCvRouter: MutableRefObject | null> = useRef(null); let isDestroyed = useRef(false); - const decodeImg = async (e: React.ChangeEvent) => { + const captureImage = useCallback(async (e: React.ChangeEvent) => { let files = [...(e.target.files as any as File[])]; e.target.value = ""; // reset input let _resultText = ""; @@ -68,7 +68,7 @@ function ImageCapture() { return (
- +
{resultText}
diff --git a/hello-world/react-hooks/README.md b/hello-world/react-hooks/README.md index 38cab83f..15c6c503 100644 --- a/hello-world/react-hooks/README.md +++ b/hello-world/react-hooks/README.md @@ -236,7 +236,7 @@ function ImageCapture() { let pCvRouter: MutableRefObject | null> = useRef(null); let isDestroyed = useRef(false); - const decodeImg = async (e: React.ChangeEvent) => { + const captureImage = useCallback(async (e: React.ChangeEvent) => { let files = [...(e.target.files as any as File[])]; e.target.value = ""; // reset input resultsContainer.current!.innerText = ""; @@ -291,7 +291,7 @@ function ImageCapture() { return (
- +