diff --git a/src/js/components/root.js b/src/js/components/root.js index b626ab4..50505a5 100644 --- a/src/js/components/root.js +++ b/src/js/components/root.js @@ -69,13 +69,13 @@ class RoutePlanner extends Component { constructor(props) { super(props); this.state = { - fromStation: null, - toStation: null, + fromStation: "", + toStation: "", }; } static getDerivedStateFromProps(props, state) { - if (state.fromStation === null && props.stations && props.stations[0]) { + if (state.fromStation === "" && props.stations && props.stations[0]) { const abbr = props.stations[0].abbr; return { fromStation: abbr, toStation: abbr}; } @@ -109,18 +109,15 @@ class RoutePlanner extends Component { } renderStationForm() { - let initialState = null; - if (this.props.stations && this.props.stations[0]) { - initialState = this.props.stations[0].abbr; - } + const receivedStations = this.props.stations; return (