Skip to content

Instantly share code, notes, and snippets.

@Natedeploys
Last active October 17, 2018 14:58
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 Natedeploys/d97ef41f3633710d48e421ff1acf0822 to your computer and use it in GitHub Desktop.
Save Natedeploys/d97ef41f3633710d48e421ff1acf0822 to your computer and use it in GitHub Desktop.
// Packages, Components
import React, { Component } from "react";
import SearchField from "../components/SearchField";
class Search extends Component {
constructor(props) {
super(props);
this.state = {
keyword: ""
};
}
handleKeyword = keyword => {
this.setState({
keyword
});
};
handleFetch = () => {
// Your fetch code here, access keyword with this.state.keyword
// You can also pass it in as a parameter but its up to you
};
render() {
return (
<div>
<SearchField
keyword={this.state.keyword}
handleKeyword={this.handleKeyword}
handleFetch={this.handleFetch}
/>
</div>
);
}
}
export default Search;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment