usePage().props.value and computed() This doesn't seem to work with vue 3 composition API, or am I doing something wrong?
const successMessage = computed(() => usePage().props.value.flash.success
})
Did all imports but it doesn't return the message
There is a little } (curly bracket) in your code. Is that a bug? This should work:
<script setup>
import { computed } from 'vue';
import { usePage } from '@inertiajs/inertia-vue3';
const successMessage = computed(() => usePage().props.value.flash.success);
</script>
Also, Make sure backend is returning the flash message correctly with Vue DevTools.
Thanks @niush ! I should have checked the code better. It also needs to add ".value" to the const that is using the computed property, otherwise it won't work
Please sign in or create an account to participate in this conversation.