Search
 
SCRIPT & CODE EXAMPLE
 

TYPESCRIPT

promise.all inside useEffect

  useEffect(() => {
    (async () => {
      try {
        let url = `https://graph.instagram.com/${id}/children?access_token=${process.env.ig_user_access_token}`;
        const {
          data: { data },
        } = await axios.get(url);

        let imagesUrl = data?.map(async item => {
          const { data: singleImage } = await axios.get(
            `https://graph.instagram.com/${item.id}?fields=media_url&access_token=${process.env.ig_user_access_token}`
          );
          return singleImage;
        });

        Promise.all(imagesUrl).then(res => {
          setCarouselImages(res);
        });
      } catch (error) {
        toast({
          title: 'Error',
          description: error.message,
          status: 'error',
          duration: 9000,
          isClosable: true,
        });
      }
    })();
  }, []);
Comment

PREVIOUS NEXT
Code Example
Typescript :: download toasts in django 
Typescript :: gettime is not a function typescript 
Typescript :: accessing widgets in screen manager kivy 
Typescript :: typescript default value if null 
Typescript :: python remove all double elements from list 
Typescript :: Unshift type Typescript 
Typescript :: pass command line arguments with spaces cmd 
Typescript :: accessing the elements of a char* in c 
Typescript :: use pipe in ts file angulr 
Typescript :: htmlspecialchars() expects parameter 1 to be string array given in laravel blade 
Typescript :: socket.io auth 
Typescript :: ERROR Error: mat-form-field must contain a MatFormFieldControl. 
Typescript :: typeorm configuration typescript 
Typescript :: typescript cast string to number 
Typescript :: script editor google sheets create new sheet 
Typescript :: across tab localstorage 
Typescript :: java login attempts using for loop 
Typescript :: Angular Compiler Options to enable AOT compilation 
Typescript :: check if all array elements match closure swift 
Typescript :: typescript compile stop using required 
Typescript :: When do you choose automated testing over manual testing? 
Typescript :: cpt ui plugin hidden single post type from search results in website 
Typescript :: deleting a generated lib in nx 
Typescript :: adonis route group 
Typescript :: ruby all elements in array are equal 
Typescript :: DISTINQUISH BETWEEN THE AVERAGE CASE AND WORSE CASE RUNNING TIME AND THE FACTORS AFFECTING THAT AFFECTS THE RUNNING TIME OF AN ALGORITHM 
Typescript :: classes and objects in python ppt 
Typescript :: angular child routes not working 
Typescript :: e.target.value typescript 
Typescript :: dynamic keys 
ADD CONTENT
Topic
Content
Source link
Name
7+9 =