Skip to content

Instantly share code, notes, and snippets.

@productioncoder
Created November 24, 2018 13:12
Embed
What would you like to do?
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