Created
June 28, 2019 16:38
-
-
Save FreddyPoly/ef6c50944f226abc77dd33770e4bde97 to your computer and use it in GitHub Desktop.
[REACT NATIVE] Mobx Component Usage Example
This file contains hidden or 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 * as React from "react" | |
import { View } from "react-native" | |
import { ApiStore } from "../../services/api/api-store" | |
import { inject } from "mobx-react" | |
export interface FirstExampleScreenProps extends NavigationScreenProps<{}> { | |
apiStore: ApiStore, | |
} | |
@inject("apiStore") | |
export class FirstExampleScreen extends React.Component<FirstExampleScreenProps, {}> { | |
nextScreen = () => this.props.navigation.navigate("secondExample") | |
componentWillMount = async () => { | |
const res = await this.props.apiStore.test(); | |
} | |
render() { | |
return ( | |
<View> | |
... | |
</View> | |
) | |
} | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment