Just wondering if it's ok to use Options API alongside Composition API
@ufodisko No. It’s one or the other.
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Just wondering if it's ok to use Options API alongside Composition API
I'm a big fan of Options API and have never used Composition API before.
I just installed Jetstream (with Inertia/Vue) and it comes with Composition API by default.
However, I used Options API (as a test) in of the components and it looks like it's working.
<script setup>
import AppLayout from "@/Layouts/AppLayout.vue"
</script>
<script>
import { Head, Link } from '@inertiajs/vue3';
import { defineComponent } from "vue"
export default defineComponent({
// I directly send properties from backend and they get populated in as props
props: {
title: String,
content: String
},
methods: {
alert() {
alert('This button works')
}
}
});
</script>
<template>
<Head title="Test" />
<AppLayout title="Test">
<template #header>
<h2 class="font-semibold text-xl text-gray-800 leading-tight">
Test
</h2>
</template>
<div class="py-12">
<div class="max-w-7xl mx-auto sm:px-6 lg:px-8">
<div class="bg-white overflow-hidden shadow-xl sm:rounded-lg p-5">
<button class="p-2 bg-purple-500 hover:bg-purple-700 text-white rounded" @click="alert">Click Me</button>
</div>
</div>
</div>
</AppLayout>
</template>
Please or to participate in this conversation.