In reactive
in vue api composition, should I use ref or not? is it the same? reactive does what ref do?
const state = reactive({
loading: ref(true)
});
or
const state = reactive({
loading: true
});
You don't need to do that. You can just use state.loading = something
and it's already reactive.
But please be aware of this. state.loading = ture/false
is reactive but state = { loading: true/false }
is not reactive and you can lose the reactive variable reference
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.