Created
September 13, 2020 09:57
-
-
Save lakshaygupta21/af21c7cdfc69b2a0b5e4f3154b8346cc to your computer and use it in GitHub Desktop.
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'; | |
import logo from './logo.svg'; | |
import axios from 'axios' | |
import './App.css'; | |
function App() { | |
const[data,setData] = useState({ | |
flag:false, | |
result:'' | |
}) | |
const{result,flag} = data; | |
async function predict(par){ | |
setData({ | |
...data, | |
flag:true | |
}) | |
const response = await axios.get(`http://localhost:3001/${par}`) | |
setData({ | |
...data, | |
flag:false, | |
result:response.data.result | |
}) | |
console.log(result) | |
} | |
return ( | |
<React.Fragment> | |
<div style={{textAlign:'center',fontSize:'larger'}}>Check the value of 1 USD after <input type = "number" onChange={(e)=>{ | |
predict(e.target.value) | |
console.log(e.target.value) | |
}}></input> days in INR</div> | |
<div style={{textAlign:'center', fontSize:'10rem'}}> | |
{!flag && <div><i class="fa fa-inr" aria-hidden="true"></i>{result}</div> } | |
</div> | |
</React.Fragment> | |
); | |
} | |
export default App; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment