Created
September 19, 2017 03:57
-
-
Save ThrowJojo/64e8534b050caeb793b8440b3b05646c to your computer and use it in GitHub Desktop.
A Counter Component using MobX
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
// @flow | |
import React, { Component } from "react"; | |
import { View, Text, StyleSheet } from "react-native"; | |
import { observer, inject } from "mobx-react"; | |
@inject("counterStore") | |
@observer | |
export default class Counter extends Component { | |
render() { | |
return ( | |
<View style={Styles.container}> | |
<Text>Current Count: {this.props.counterStore.count}</Text> | |
</View> | |
); | |
} | |
} | |
let Styles = StyleSheet.create({ | |
container: { | |
padding: 15 | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment