Last active
June 13, 2018 03:25
-
-
Save ldiego08/d02985103c552fb075538761c08ef549 to your computer and use it in GitHub Desktop.
State Management - Components
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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