import React from 'react'; class App extends React.Component { constructor(props) { super(props); this.state = { error: null, albums: null, }; } componentDidMount() { fetch(process.env.PUBLIC_URL + "/photosync/albums.json") .then(res => res.json()) .then( (result) => this.setState({albums: result}), (error) => this.setState({error}), ); } render() { let {error, albums} = this.state; console.log(this.state); let content; if (error !== null) { content =

Error: {JSON.stringify(error)}

; } else if (albums !== null) { console.log(albums); content = albums.map((a) => { let thumb = ; if (a.coverPhotoBaseUrl !== undefined) { thumb = {; } return
{thumb}
{ a.title }
{ a.mediaItemsCount } photos
}); } else { content =

Loading...

; } return (
{ content }
); } } export default App;