What are composables in Nuxt?
javascript
// composables/useCounter.ts
export const useCounter = () => {
const count = useState("counter", () => 0);
const increment = () => count.value++;
const decrement = () => count.value--;
return {
count,
increment,
decrement
};
};
// Usage in any component (auto-imported!)
const { count, increment } = useCounter();Short Answer
Interview readyPremium
A concise answer to help you respond confidently on this topic during an interview.