gloriasoft / veaury

Use React in Vue3 and Vue3 in React, And as perfect as possible!
MIT License
1.27k stars 81 forks source link

Best way to trigger React method from Vue is via props? #105

Closed titusdecali closed 4 months ago

titusdecali commented 8 months ago

In the events (React in Vue app) section of the docs, I don't see any explanation of how we should trigger functions within a React app via Vue. I have a special use case where, depending on the Vue action taken, I need to trigger a React method, or a vue method.

Thus, I need a way to fire a React method in a React component which is a child of a Vue component (and the trigger should be started from within Vue)

Is the best way to do this by passing a prop fireFunction: true to React and then using useEffect watcher to trigger the internal React function? Seems a bit like an anti-pattern... so I'm curious what you would do here.

Thanks for this library!

devilwjp commented 8 months ago

https://github.com/devilwjp/veaury?tab=readme-ov-file#usage-of-getting-ref

@titusdecali