akxcv / vuera

:eyes: Vue in React, React in Vue. Seamless integration of the two. :dancers:
MIT License
4.3k stars 242 forks source link

How to pass variable to Vue component from React #77

Open albedo-tech opened 5 years ago

albedo-tech commented 5 years ago

Trying to pass property to vue component from react. Here's working code with a static string as property: <div id='vue-container'><some-tag msg="hello" /></div> But I need to pass a variable (e.g. some object):

I tried to do it this way, but it didn't work. <div id='vue-container'><some-tag msg={testVariable} /></div>

akxcv commented 5 years ago

Hi! Doesn't <some-tag msg="testVariable" /> work?

albedo-tech commented 5 years ago

@akxcv Nope. This variable will be passed as string.

akxcv commented 5 years ago

Are you using JSX with Vue?

albedo-tech commented 5 years ago

@akxcv Yes.

akxcv commented 5 years ago

Can you please show the whole render function?

arckdash commented 4 years ago

well that's 'cause you're assigning a string as the value of the property u want to pass.

use this instead:

<VueWrapper
    component={myComponent}
    message={this.message}
    orientation="right"
/>