An open API service indexing awesome lists of open source software.

https://github.com/mitscherlich/vue-forward-ref

Portal `React.forwardRef` api into Vue
https://github.com/mitscherlich/vue-forward-ref

Last synced: about 1 year ago
JSON representation

Portal `React.forwardRef` api into Vue

Awesome Lists containing this project

README

          

# v-forward-ref

[![npm version](https://badgen.net/npm/v/v-forward-ref)](https://npm.im/v-forward-ref) [![npm downloads](https://badgen.net/npm/dm/v-forward-ref)](https://npm.im/v-forward-ref)

## Install

via `pnpm`, `yarn` or `npm`:

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

## How to use

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

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

return () =>

{props.message}

})

const Wrap = forwardRef((props, { slots }, ref) => {
return
})

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

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

return () =>
})
```

## License

MIT © [Mitscherlich](https://mitscherlich.me)