1
votes

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
});
1

1 Answers

0
votes

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