-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathApp.js
More file actions
31 lines (27 loc) · 753 Bytes
/
App.js
File metadata and controls
31 lines (27 loc) · 753 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import React, { useState, useEffect } from "react";
import { Container, Row, Col } from "reactstrap";
import "bootstrap/dist/css/bootstrap.min.css";
import "./App.css";
import Axios from "axios";
import CardData from "./CardData";
function App() {
const [details, setDetails] = useState({});
const fetchData = async () => {
const { data } = await Axios.get(`https://randomuser.me/api/`);
const details = data.results[0];
setDetails(details);
};
useEffect(() => {
fetchData();
}, []);
return (
<Container fluid className="p-4 bg-primary App">
<Row>
<Col md={4} className="offset-md-4 mt-4">
<CardData details={details} />
</Col>
</Row>
</Container>
);
}
export default App;