Skip to content

Instantly share code, notes, and snippets.

@ldiego08
Last active June 13, 2018 03:25
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 ldiego08/d02985103c552fb075538761c08ef549 to your computer and use it in GitHub Desktop.
Save ldiego08/d02985103c552fb075538761c08ef549 to your computer and use it in GitHub Desktop.
State Management - Components
import React, { Component } from 'react';
export interface HeaderProps {
searchBoxProps: SearchBoxProps;
}
export class Header extends Component<HeaderProps> {
render() {
return (
<div>
<SearchBox {...this.props.searchBoxProps} />
</div>
);
}
}
export interface SearchBoxProps {
query?: string;
isLoading: string;
data: string[];
onSearch?: (query: string) => void;
}
export class SearchBox extends Component<SearchBoxProps> {
render() {
// Render the component ..
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment