-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathApp.js
More file actions
38 lines (34 loc) · 1.16 KB
/
App.js
File metadata and controls
38 lines (34 loc) · 1.16 KB
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
32
33
34
35
36
37
38
import React, { useState, useEffect } from 'react';
import { ContentLayout, Container, Header, SpaceBetween } from '@cloudscape-design/components';
import '@cloudscape-design/global-styles/index.css';
import { AmplifyConfig as config } from './Config';
import { Amplify, API } from 'aws-amplify';
import '@aws-amplify/ui-react/styles.css';
Amplify.configure(config);
Amplify.Logger.LOG_LEVEL = 'DEBUG';
console.log(config.API);
const App = () => {
const [helloWorld, setHelloWorld] = useState('');
useEffect(() => {
const fetchData = async () => {
const exampleResponse = await API.post('exampleApi', 'example', {});
console.log(exampleResponse);
setHelloWorld(exampleResponse.message);
};
fetchData().catch(console.error);
}, []);
return (
<ContentLayout
header={
<SpaceBetween size="m">
<Header variant="h1">Single Stack Full Stack Example</Header>
</SpaceBetween>
}
>
<Container>
<h2>{helloWorld}</h2>
</Container>
</ContentLayout>
);
};
export default App;