Created
March 26, 2018 15:28
-
-
Save pinglinh/db7c3ea9e0575a7fbb98da824bd688d5 to your computer and use it in GitHub Desktop.
Refactoring React components : Search 1.3.1
This file contains 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 SearchResult from "../SearchResult"; | |
const Search = props => { | |
return ( | |
<div> | |
<h1>The Guardian Search App</h1> | |
<form onSubmit={props.handleSubmit}> | |
<input | |
type="text" | |
value={props.value} | |
onChange={props.performSearch} /> | |
</form> | |
<div> | |
{props.articles.map((article, index) => { | |
return <SearchResult key={index} result={article} />; | |
})} | |
</div> | |
</div> | |
); | |
}; | |
export default Search; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment