Closed juanparati closed 1 year ago
Actually is not possible to call React components methods from Vue, because the internal reference bind to the React component is missing. I implemented a way to obtain the internal reference calling the "reactRef" method.
Example:
<template> <div> <MyReactComp ref="myReactComp" /> <button type="button" @click="$refs.myReactComp.reactRef().reactMethodFooBar()">Call React Method</button> </div> </template> <script> import { ReactInVue } from "vuera-ts"; import { ReactComp } from "./ReactComp"; const MyReactComp = ReactInVue(MyReactComp); export default { name: "VueApp", }; </script>
$refs.myReactComp.reactRef().reactMethodFooBar() does the IDE figure the reactMethodFooBar type - so does the typing works with autocompletion?
$refs.myReactComp.reactRef().reactMethodFooBar()
reactMethodFooBar
edit: just noticed it doesn't.
Actually is not possible to call React components methods from Vue, because the internal reference bind to the React component is missing. I implemented a way to obtain the internal reference calling the "reactRef" method.
Example: