Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

To fix, cancel all subscriptions and asynchronous tasks in a useEffect cleanup function.

//101-Example
const callback = useCallback((event: any) => {
      event.data.status === "complete" ? setProgress(0) : setProgress(event.data.uploadProgress);
    },[])
  
  useEffect(() => {
    window.addEventListener("file-upload", callback);
    return () => window.removeEventListener("file-upload", callback);
  }, [window, callback]);
Comment

PREVIOUS NEXT
Code Example
Javascript :: While loop factorial function in javascript 
Javascript :: Remove duplication from array in javascript 
Javascript :: react navigation header background color 
Javascript :: js array set value at index 
Javascript :: getting state in react-router-dom v6 
Javascript :: how to convert entered number into currency in words in javascript 
Javascript :: add property to object conditionally 
Javascript :: reverse string js 
Javascript :: alphabet string javascript 
Javascript :: javascript check if string contains character 
Javascript :: regex pattern for strong password 
Javascript :: DragDropContext 
Javascript :: how to close tab by javascript 
Javascript :: jquery get aria-label value 
Javascript :: unshift 
Javascript :: createrouter vue 3 history remove Hash 
Javascript :: ionic status bar color 
Javascript :: javascript read server file 
Javascript :: Write the JavaScript code to set the width of element to 50%; 
Javascript :: create array javascript 
Javascript :: javascript get parent element height javascript 
Javascript :: how to validate the radio button using jquery 
Javascript :: click on a radio button using jquery 
Javascript :: react native android padding style 
Javascript :: xmlhttprequest javascript 
Javascript :: angular loop 
Javascript :: foreach loop in react 
Javascript :: upload file in react 
Javascript :: js escape characters 
Javascript :: regexp constructor js 
ADD CONTENT
Topic
Content
Source link
Name
8+6 =