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
var asyncTask1=()=>{ | |
return new Promise((resolve,reject)=>{ | |
setTimeout(()=>{ | |
resolve({message:"Done the AsyncTask 1 "}); | |
},100); | |
}) | |
} | |
var asyncTask2=()=>{ | |
return new Promise((resolve,reject)=>{ | |
setTimeout(()=>{ |
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,{Component} from 'react'; | |
function fetchFromApi(){ | |
//APi call | |
} | |
class NewYorkStock extends Component{ | |
constructor(props){ | |
this.state={ | |
name:'NewYork' | |
} | |
} |
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 } from 'react'; | |
function Home() { | |
const [count, setCount] = useState(0); | |
return ( | |
<div> | |
<p>You visited {count} times</p> | |
<button onClick={() => setCount(count + 1)}> | |
Visit | |
</button> |
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
function NewYorkExchange(props) { | |
const stockValue = useStockHandler({id:"NewYork"}); | |
return ( | |
<p> The current stock value is {stockValue}</p> | |
); | |
} |