From 5a11b115e0805fef229cb9922f0d97c45b42ff35 Mon Sep 17 00:00:00 2001 From: briandennis Date: Tue, 6 Feb 2018 13:56:18 -0600 Subject: [PATCH] if no selected value, provide default value --- components/Dropdown.js | 2 +- components/FontSelect.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/components/Dropdown.js b/components/Dropdown.js index 142d6be..352e05d 100644 --- a/components/Dropdown.js +++ b/components/Dropdown.js @@ -71,7 +71,7 @@ class Dropdown extends React.Component { onClick={this.toggle} >
- {this.props.selected.name} + {this.props.selected ? this.props.selected.name : ''}
diff --git a/components/FontSelect.js b/components/FontSelect.js index c5ff603..442ba2b 100644 --- a/components/FontSelect.js +++ b/components/FontSelect.js @@ -48,7 +48,7 @@ export default class extends React.Component { } render() { - const selectedFont = FONTS.filter(font => font.id === this.props.selected)[0] + const selectedFont = FONTS.filter(font => font.id === this.props.selected)[0] || {} return (