Skip to content

Instantly share code, notes, and snippets.

@ThrowJojo
Created September 19, 2017 03:57
Show Gist options
  • Save ThrowJojo/64e8534b050caeb793b8440b3b05646c to your computer and use it in GitHub Desktop.
Save ThrowJojo/64e8534b050caeb793b8440b3b05646c to your computer and use it in GitHub Desktop.
A Counter Component using MobX
// @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