useContext

You can access the Nuxt context within the composition API

You can access the Nuxt context more easily using useContext, which will return the Nuxt context.

import { defineComponent, useContext } from '@nuxtjs/composition-api'

export default defineComponent({
  setup() {
    const { store } = useContext()
    store.dispatch('myAction')
  },
})
Note that route, query, from and params are reactive refs (accessed with .value), but the rest of the context is not.
To smooth your upgrade to Nuxt 3, it is recommended not to access route, query, from and params from useContext but rather to use the useRoute helper function.