Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // @flow
- import React,{ Component } from 'react';
- type Props<T> = {
- fetch: () => Promise<T>,
- cb: T => T,
- };
- class Client<T> extends Component<Props<T>> {
- componentDidMount() {
- const { fetch, cb } = this.props;
- fetch().then(cb);
- }
- render() {
- return (<div />)
- }
- }
- const App = <Client
- fetch={ () => Promise.resolve(1) }
- cb={ n => 'sfd' } />;
Add Comment
Please, Sign In to add comment