Closed dugajean closed 5 years ago
The plugin currently doesn't allow setup
returning a render function, as stated in README.
In fact it works in this way:
Make h
globally available: import createElement as h from '@vue/composition-api'
Make sure both setup
and the returned function are arrow functions: setup: () => { return () => <div /> }
@leopiccionia how do I access props and reactive data from the render
function then?
@beeplin This didn't work for me
@dugajean Try this: https://codesandbox.io/s/vue-render-function-sjnir
@beeplin That worked! Looks hacky though, dang.
@dugajean the important thing here is to use the babel preset vca-jsx
(as you can see in the example given).
This is working in my nuxt project:https://qiita.com/nkjmsss/items/7c61193efe390c14aa16#%E3%82%B5%E3%83%B3%E3%83%97%E3%83%AB
in version '1.6.2' The requested module '/node_modules/.vite/@vue_composition-api.js?v=82ecb7cd' does not provide an export named 'createComponent'
In Vue 2, import from vue
import {h} from "vue"
I'm using Nuxt, Nuxt Typescript, TSX and Vue Composition API. When I converted a
.vue
component into a.tsx
one, without a render method, but instead returning the JSX from the setup function, I get the following error during runtime:From my stack listed above, I didn't know which part could be causing this problem, so I'm presuming it has something to do with the Composition API package. I'm also quite unfamiliar with the Composition API and I'm trying to learn - could be I'm just doing something wrong here?
My component looks like this:
Environment Info: