From e88c8b954e90678488845efa6c53aa332b6361cc Mon Sep 17 00:00:00 2001 From: greg Date: Sat, 26 Jan 2019 01:34:35 -0800 Subject: [PATCH] Function component for entry --- App.jsx | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/App.jsx b/App.jsx index e380961..302d68a 100644 --- a/App.jsx +++ b/App.jsx @@ -20,6 +20,19 @@ function testHandler(json) { console.log(json); } +function Entry(props) { + const entry = props.entry; + return ( +
+ { entry.sai } - { entry.eng } +
+ { entry.syn_category } +
+ Type: { entry.morph_type } +
+ ); +} + class Results extends Component { constructor(props) { super(props); @@ -31,15 +44,9 @@ class Results extends Component {
Searched for { this.props.searchTerm } search type: { this.props.searchType }
); - const entries = this.props.searchResults.map((entry, idx) => { - return (
- { entry.sai } - { entry.eng } -
- { entry.syn_category } -
- Type: { entry.morph_type } -
); - }); + const entries = this.props.searchResults.map( + (entry, idx) => + ); return [header].concat(entries); }