first react attempts

This commit is contained in:
2020-05-31 13:47:57 +02:00
parent 024814429e
commit 1c2fe33cca
17 changed files with 14452 additions and 0 deletions

19
src/MainBody.js Normal file
View File

@@ -0,0 +1,19 @@
import React from "react";
class MainBody extends React.Component {
render() {
const requestOptions = {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ title: 'React POST Request Example' })
};
fetch('https://jsonplaceholder.typicode.com/posts', requestOptions)
.then(response => response.json())
.then(data => this.setState({ postId: data.id }));
return (
<div>Hey from other class</div>
);
}
}
export default MainBody;