5

The Composition API

In the previous chapter, we learned how to establish data communication between nesting components using props, refs, and slots.

This chapter will introduce us to a new and scalable approach to writing components with the setup() lifecycle hook – the Composition API. By the end of the chapter, you will be able to write isolated composables (or custom hooks) to reuse in multiple components by using the Composition API with the setup() method, and build a scalable component system for your Vue project beyond the classic Options API.

This chapter covers the following topics:

  • Creating components with the setup() lifecycle method
  • Working with data
  • Understanding composable lifecycle functions
  • Creating your composable (custom ...

Get Frontend Development Projects with Vue.js 3 - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.