v-forward-ref
TypeScript icon, indicating that this package has built-in type declarations

0.1.2 • Public • Published

v-forward-ref

npm version npm downloads

Install

via pnpm, yarn or npm:

pnpm add v-forward-ref
# or
yarn add v-forward-ref
# or
npm i -S v-forward-ref

How to use

import { forwardRef } from 'v-forward-ref'

const Comp = defineComponent((props, ctx) => {
  ctx.expose({ foo: 'bar' })

  return () => <div>{props.message}</div>
})

const Wrap = forwardRef((props, { slots }, ref) => {
  return <Comp {...props} ref={ref} v-slots={slots} />
})

const App = defineComponent(() => {
  const cmpRef = ref(null)

  onMounted(() => {
    console.log(cmpRef.value.foo) // => 'bar'
  })

  return () => <Wrap message="Hello" ref={cmpRef} />
})

License

MIT © Mitscherlich

Readme

Keywords

none

Package Sidebar

Install

npm i v-forward-ref

Weekly Downloads

3

Version

0.1.2

License

MIT

Unpacked Size

8.42 kB

Total Files

8

Last publish

Collaborators

  • mitscherlich36