Skip to content

Instantly share code, notes, and snippets.

@fadhelutama
fadhelutama / usestate - this.state
Created October 23, 2019 16:44
perbedaan simpan value usestate dan this.state
this.state = {
data: [],
};
Axios.get('http://localhost:3000/rating/' + data._id)
.then((value) => {
this.setstate({
data:value
})
@fadhelutama
fadhelutama / usestate
Created October 23, 2019 16:17
cara penggunaan usestate
import React, { useState } from 'react';
import { StyleSheet, Text, View, Button } from 'react-native';
export default function App() {
const [count, setCount] = useState(0);
return (
<View style={styles.container}>
<Text>You clicked {count} times.</Text>
<Button