Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

usestate wait for set

const [loading, setLoading] = useState(false);

...

useEffect(() => {
    doSomething(); // This is be executed when `loading` state changes
}, [loading])
setLoading(true);
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #usestate #wait #set
ADD COMMENT
Topic
Name
1+6 =