1
|
import React from 'react';
|
2
|
import { useState, useEffect } from 'react';
|
3
|
import axios from 'axios'
|
4
|
|
5
|
const App = () => {
|
6
|
|
7
|
let [data, setData] = useState(null);
|
8
|
let [loading, setLoading] = useState(false);
|
9
|
|
10
|
useEffect(() => {
|
11
|
setLoading(true);
|
12
|
|
13
|
axios
|
14
|
.get("http://localhost:8080/v2/testCall")
|
15
|
.then((result) => {
|
16
|
setData(result.data.response);
|
17
|
setLoading(false);
|
18
|
})
|
19
|
.catch((error) => console.log(error));
|
20
|
}, []);
|
21
|
|
22
|
if (loading) {
|
23
|
return <p>Loading...</p>
|
24
|
}
|
25
|
|
26
|
|
27
|
return (
|
28
|
<div className="container">{data}</div>
|
29
|
);
|
30
|
};
|
31
|
|
32
|
|
33
|
export default App;
|