-
-
Notifications
You must be signed in to change notification settings - Fork 6
Closed
Description
My current approach
import { defineComponent, h, onBeforeUnmount, onMounted, onUpdated, ref } from 'vue'
import React from 'react'
import { render, unmountComponentAtNode } from 'react-dom'
export default (Component: any) => {
return defineComponent({
props: {
defaultValue: {
type: String,
default: '',
},
},
setup(props) {
const elRef = ref()
onMounted(() => {
render(React.createElement(Component, props), elRef.value)
})
onUpdated(() => {
render(React.createElement(Component, props), elRef.value)
})
onBeforeUnmount(() => {
unmountComponentAtNode(elRef.value)
})
return () => h('div', { ref: elRef })
},
})
}Metadata
Metadata
Assignees
Labels
No labels