简体   繁体   English

React.js将多个变量传递到输入中

[英]Reactjs passing multiple variables into an input

I am new to reactjs and I am currently replacing markup into reactJs components. 我是ReactJS的新手,目前正在将标记替换为reactJs组件。

There is an input field that requires two variables 有一个输入字段,需要两个变量

<input type='hidden' id='invite-to' value='$userToCall $interviewId' />

I am used to adding one variable like this 我习惯于这样添加一个变量

<input type='hidden' id='invite-to' value={$userToCall} />

would I just add them both like so? 我是否可以像这样将它们都添加?

<input type='hidden' id='invite-to' value={$userToCall $interviewId} />
<input type='hidden' id='invite-to' value={`${userToCall} ${interviewId}`} />

Updated 更新

Try 尝试

<input type='hidden' id='invite-to' value={userToCall + interviewId} />

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM