Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 15 additions & 11 deletions 08week/starwars-app/src/App.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,24 @@
import React, { Component } from 'react';
import logo from './logo.svg';
import './App.css';

class App extends Component {
state = {
character: null,
characters: null,
}
componentDidMount() {
const.that = this;
fetch('')
// const.that = this;
fetch('https://hacker-news.firebaseio.com/v0/topstories.json?print=pretty')
.then((response) => response.json)
.then((responseJson) => )
}
.then(storyIds => {
storyIds.slice(0, 15).forEach((storyId) => {
fetch(`https://hacker-news.firebaseio.com/v0/item/${storyId}.json?print=pretty`)
.then(res => res.json())
.then(characters => {
console.log(characters);
})
});
});

renderCharacters() {
const { characters } = this.state; /*deconstruct this.state.characters*/
if(characters && characters.length > 0) {
Expand All @@ -20,13 +27,10 @@ class App extends Component {
})
}
}

render() {
return (
<div className="App">
<header className="App-header">
<img src={logo} className="App-logo" alt="logo" />
<h1 className="App-title">Star Wars</h1>
</header>
<div>
{this.renderCharacters()}
</div>
);
Expand Down
21 changes: 21 additions & 0 deletions 08week/toast-app/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# See https://help.github.com/ignore-files/ for more about ignoring files.

# dependencies
/node_modules

# testing
/coverage

# production
/build

# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local

npm-debug.log*
yarn-debug.log*
yarn-error.log*
2,229 changes: 2,229 additions & 0 deletions 08week/toast-app/README.md

Large diffs are not rendered by default.

Loading