h-demi - h
function for Vue 2 and 3
#74
Replies: 3 comments 1 reply
-
Nice working on h-demi!
In case you missed them, there are some good news:
After that, the mission of Before that, if someone what to have the compatible render function, definitely have a try with h-demi with the links above. Thanks. |
Beta Was this translation helpful? Give feedback.
-
Nice! Thank for your working, it also helps me. |
Beta Was this translation helpful? Give feedback.
-
Thanks for the |
Beta Was this translation helpful? Give feedback.
-
I've started to build a library for vue and wanted to make it compatible with vue2 and vue3, so I decided to use VueDemi.
The library I'm building is vue-insta-stories a component library, I've struggled a little bit to make it compatible with both vue 2 & 3, first I've tried to use but didn't manage to get it working. I was using rollup to build it.
So I checked some examples on the vue-demi repo and discovered that everybody was using render and h to build templates, I switched to render function and everything seems to work nice, except that the first guy using it, was using vue2 and had some errors, after some checking I found out that the h function as different behaviours if used in vue2 and vue3 (I've never used render functions before :D)
To fix the issue I made a wrapper to the h function (h-demi.ts) basically the function has the same interface as vue2 createElement, and if you are using vue3 it adapts the arguments to the h function.
The version of h-demi.ts that I've written is pretty simple, it covers only what I used in vue-insta-stories, and is missing a lot of typings.
I was wondering if a more robust version of h-demi would be a "nice to have" feature inside vue-demi or vue/composition-api. That would help a lot of people that want to build a library and make it compatible with both 2 & 3 versions of vue.
That was my first approach to a library, I may also got the whole building process wrong, but I didn't found examples or really good guides, so i mixed up what I've found (if there is an another way of fix the render issues please tell me <3)
Beta Was this translation helpful? Give feedback.
All reactions