Reactjs 如何在JSX中调用arrow函数内部的另一个函数?
我有一个使用回调函数的组件,当它被执行时,我让它呈现一个视频标签。但我也想在视频标记之后使用ipcrender.send,但不知道如何正确编写它来实现Reactjs 如何在JSX中调用arrow函数内部的另一个函数?,reactjs,electron,Reactjs,Electron,我有一个使用回调函数的组件,当它被执行时,我让它呈现一个视频标签。但我也想在视频标记之后使用ipcrender.send,但不知道如何正确编写它来实现 <div className="main-user-video"> {/* TODO: Use WebRTC.onCallUserAdded to add another and add another video with the new remoteStream */}
<div className="main-user-video">
{/* TODO: Use WebRTC.onCallUserAdded to add another and add another video with the new remoteStream */}
<video
id="video_player"
className="main-user-video"
// style={
// this.state.knocking.callAccepted
// ? null
// : { filter: "grayscale(100%)" }
// }
controls={false}
ref={this.remoteVideo}
autoPlay={true}
></video>
{WebRTC.onCallUserAdded((err, callId, userId, audio, video, remoteStream, usersInCall) =>
<video
id="video_player"
className="main-user-video"
controls={false}
ref={remoteStream}
autoPlay={true}
></video>
{(usersInCall > 2) ? electron.ipcRenderer.send("MULTI-PARTY-CALL") : null}
)}
</div>
{/*TODO:使用WebRTC.oncalUserAdded添加另一个视频,并使用新的remoteStream添加另一个视频*/}
{WebRTC.oncalUserAdded((err、callId、userId、音频、视频、remoteStream、usersInCall)=>
{(usersInCall>2)?electron.ipcRenderer.send(“多方调用”):null}
)}
就在第二个视频标记之后,我要使用IPC渲染器。箭头函数是返回值的函数的简写形式
() => <video/>
()=>
相等于
() => {
return <video/>
}
()=>{
返回
}
在回来之前,你可以在街区里做任何你想做的事
() => {
// call function or any process
return <video/>
}
()=>{
//调用函数或任何进程
返回
}
electron.ipcRenderer.send是否有返回值?这可能回答了问题的标题,但我希望作者是想问些别的问题,我差点就想到了useEffect等等,而不是这个非常基本的答案,但也许他/她对此很满意