Skip to content

Instantly share code, notes, and snippets.

@ozcanzaferayan
Created January 29, 2020 20:47
Show Gist options
  • Save ozcanzaferayan/14758afa9d2d4fb661fd3c0b20e505b9 to your computer and use it in GitHub Desktop.
Save ozcanzaferayan/14758afa9d2d4fb661fd3c0b20e505b9 to your computer and use it in GitHub Desktop.
Mobx Test
import React from 'react';
import { Button, Text, SafeAreaView } from 'react-native';
import { observable } from 'mobx';
import { observer } from 'mobx-react';
@observer export class LoginScreen extends React.Component {
@observable count = 0;
handleInc = () => this.count++;
handleDesc = () => this.count--;
render() {
return (
<SafeAreaView>
<Button title=" + " onPress={this.handleInc}/>
<Button title=" - " onPress={this.handleDesc}/>
<Text style={{alignSelf:'center'}}>{this.count}</Text>
</SafeAreaView>
)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment