Slide 59
Slide 59 text
const injectables: Injectables = {
i18n: new I18n(),
httpClient: new HttpClient(),
endpoints: {
search: '...',
},
}
type Props = Pick
class GithubRepoList extends Component {
componentDidMount() {
const { httpClient, endpoints } = this.props
httpClient
.get>(`${endpoints.search}?q=react`)
.then(({data}) => {
this.setState({results: data || [],})
})
}
}
const EnhancedGithubRepoList = inject(
({ httpClient, endpoints }: Injectables) => ({ httpClient,endpoints})
)(GithubRepoList)