-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3272d14
commit 5de98b9
Showing
12 changed files
with
60,449 additions
and
14,370 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import React, { Component } from 'react'; | ||
|
||
// this blocks component will make a request to the | ||
// blocks endpoint of the backend, which will return data of te blocks | ||
class Blocks extends Component { | ||
state = { blocks: []}; | ||
|
||
componentDidMount() { | ||
fetch('http://localhost:2000/api/blocks') | ||
.then(response => response.json()) | ||
.then(json => this.setState({ blocks: json })); | ||
} | ||
|
||
render() { | ||
console.log('this.state', this.state); | ||
|
||
return ( | ||
<div> | ||
<h3>Blocks</h3> | ||
{this.state.blocks.map((block, index) => ( | ||
<div key={index}> | ||
<p>Block data: {JSON.stringify(block)}</p> | ||
</div> | ||
))} | ||
</div> | ||
) | ||
} | ||
} | ||
|
||
export default Blocks; |
Oops, something went wrong.