Created
January 29, 2020 20:47
-
-
Save ozcanzaferayan/14758afa9d2d4fb661fd3c0b20e505b9 to your computer and use it in GitHub Desktop.
Mobx Test
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 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