Hello, I need to know an image URI and name after a click on it in react to use them in a function to open the image in the image editor. **Is it possible to save each of them in a variable separately?**
@SempervivumJan 05.2021 — #I took a look at the docu of React:
https://reactjs.org/docs/handling-events.html
and obviously `event` is available in the event handlers. Thus you can easily get the target or clicked element and it's attributes: function ActionLink() { function handleClick(e) { e.preventDefault(); console.log('The link was clicked.'); const title = e.target.title, alt = e.target.alt; console.log('Title=' +title + ' alt=' + alt); }
return ( <a href="#" onClick={handleClick}> Click me </a> ); }