Skip to content

Instantly share code, notes, and snippets.

@productioncoder
Created November 24, 2018 13:12
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save productioncoder/87829b4247870c6bd086cecdf09e0aea to your computer and use it in GitHub Desktop.
Youtube in React: event handlers for form
/* ... */
export class HeaderNav extends React.Component {
/* ... */
onInputChange = (event) => {
this.setState({
query: event.target.value,
});
};
onSubmit = () => {
const escapedSearchQuery = encodeURI(this.state.query);
this.props.history.push(`/search?search_query=${escapedSearchQuery}`);
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment