Skip to content

Instantly share code, notes, and snippets.

@pinglinh
Created March 26, 2018 15:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pinglinh/db7c3ea9e0575a7fbb98da824bd688d5 to your computer and use it in GitHub Desktop.
Save pinglinh/db7c3ea9e0575a7fbb98da824bd688d5 to your computer and use it in GitHub Desktop.
Refactoring React components : Search 1.3.1
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