Minor modifications to Example API components and base classes
This commit is contained in:
@ -1,6 +1,8 @@
|
||||
import React from 'react';
|
||||
import axios from 'axios';
|
||||
import AccessToken from '../classes/AccessToken'
|
||||
import AccessToken from '../classes/AccessToken';
|
||||
import StopComponent from './StopComponent';
|
||||
import Stop from '../classes/Stop';
|
||||
|
||||
class NearbyStation extends React.Component {
|
||||
state = {
|
||||
@ -58,18 +60,11 @@ class NearbyStation extends React.Component {
|
||||
{this.state.long}
|
||||
</h1>
|
||||
{this.state.stops.map((item) =>
|
||||
<div>
|
||||
<h1>
|
||||
{item.name},
|
||||
{item.id},
|
||||
{item.lat},
|
||||
{item.lon},
|
||||
{item.track}
|
||||
</h1>
|
||||
</div>
|
||||
<StopComponent stop={item} />
|
||||
)}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
export default NearbyStation
|
||||
|
19
src/components/StopComponent.js
Normal file
19
src/components/StopComponent.js
Normal file
@ -0,0 +1,19 @@
|
||||
import React, {Component} from 'react';
|
||||
|
||||
class StopComponent extends Component {
|
||||
render() {
|
||||
return (
|
||||
<div>
|
||||
<h1>
|
||||
{this.props.stop.name},
|
||||
{this.props.stop.id},
|
||||
{this.props.stop.lat},
|
||||
{this.props.stop.lon},
|
||||
{this.props.stop.track}
|
||||
</h1>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
// TODO Add css
|
||||
export default StopComponent
|
Reference in New Issue
Block a user