This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
This program simulates the async/await pattern in javascript. | |
The fetchData function simulates an async call, the corountine | |
function is used to initialize a generator (genObj) that is passed | |
as an argument. It then immediately invokes the recursive function | |
(run), which handles processing the generator until done:true. | |
It does this by using the value (promise obj) it receieves from calling | |
next() on the genObj. Once the value is resolved, it is passed to the run | |
function as an argument (result), and that argument is passed to the next() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { useState, useEffect } from 'react'; | |
import axios from 'axios'; | |
import { withRouter } from 'react-router-dom'; | |
import DemoHeader from './DemoHeader'; | |
import SelectFileHeader from './SelectFileHeader'; | |
import SelectFileInput from './SelectFileInput'; | |
import DemoSearchHeader from './DemoSearchHeader'; | |
import DemoSearch from './DemoSearch'; | |
import ResultCard from './ResultCard'; |