I have a onClick function in react js, now i want to pass multiple parameters with e.target parameters. if I'm using multiple parameters then e.target is not working. How to do this?
My Code:-
export const App = () => { const move_box_click = (x, y, boxHeight, boxWidth, e) => { console.log(x, y, boxHeight, boxWidth); console.log (e.target.id) }; return( <> <input type="input" id="email" name="Email" value={value} onClick={()=>move_box_click(100, 95, 30, 100)} /> <input type="input" id="phone" name="Phone" value={value} onClick={()=>move_box_click(100, 95, 30, 100)} /> </> ) }
Thanks for your efforts!
also need to pass event
onClick={(event)=>move_box_click(100, 95, 30, 100,event)}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.