Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
perbedaan simpan value usestate dan this.state
this.state = {
data: [],
};
Axios.get('http://localhost:3000/rating/' + data._id)
.then((value) => {
this.setstate({
data:value
})
//// di bawah menggunakan usestate dan atas menggunakan this.state
const [rating, setrating] = useState('');
Axios.get('http://localhost:3000/rating/' + data._id)
.then((value) => {
setrating(value.data)
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.