This file contains hidden or 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
| import React from 'react'; | |
| import DestinationItem from "./DestinationItem"; | |
| export default class DestinationList extends React.Component { | |
| render() { | |
| let { data } = this.props; | |
| return ( | |
| <div> | |
| <h1>Here are your best Travel Destinations</h1> |
This file contains hidden or 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
| render() { | |
| return ( | |
| <div className="App"> | |
| <DestinationList | |
| data={this.state.data} | |
| /> | |
| </div> | |
| ); | |
| } |
This file contains hidden or 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
| componentWillMount() { | |
| this.loadDestinations(); | |
| } |
This file contains hidden or 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
| updateData(responseData) { | |
| this.setState({data: responseData.data}); | |
| } |
This file contains hidden or 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
| loadDestinations() { | |
| // Fetch Destinations. | |
| fetch(LIST_URL, {mode:'cors'}) | |
| .then(function (response) { | |
| return response.json(); | |
| }) | |
| .then((data) => this.updateData(data)) | |
| .catch(err => console.log('Fetching Destinations Failed', err)); | |
| } |
This file contains hidden or 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
| const LIST_URL = 'http://td-drupal.local:80/jsonapi/node/destination'; |
This file contains hidden or 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
| constructor() { | |
| super(); | |
| this.state = { data: null }; | |
| this.loadDestinations = this.loadDestinations.bind(this); | |
| this.updateData = this.updateData.bind(this); | |
| } |
This file contains hidden or 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
| import React, { Component } from 'react'; | |
| import logo from './logo.svg'; | |
| import './App.css'; | |
| import DestinationList from "./Components/Destination/DestinationList"; | |
| class App extends Component { | |
| render() { | |
| return ( | |
| <div className="App"> | |
| <DestinationList/> |
This file contains hidden or 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
| import React from 'react'; | |
| import DestinationItem from "./DestinationItem"; | |
| export default class DestinationList extends React.Component { | |
| render() { | |
| return ( | |
| <div> | |
| <h1>Here are your best Travel Destinations</h1> | |
| <DestinationItem/> |
This file contains hidden or 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
| import React from 'react'; | |
| export default class DestinationItem extends React.Component { | |
| render() { | |
| return ( | |
| <div> | |
| <h2>Travel Destination Title</h2> | |
| <div>Travel Destination Description goes here</div> |