What is the act of console.log in react?

Hello,

What is the act of console.log in react?

thanks,

Saeed

console.log() is a JavaScript method, it prints whatever value you put in it to the console, really useful for debugging

This method lets the programmer know what happening or lets the program know what happens?
For example:

const onImageClick = event => console.log(event.target.value.src)
...
<img src={variableHere}, onClick={onImageClick} />

This lets us know the clicked src or let for example a function knows src of the clicked item?

the console.log does nothing with the values other than printing stuff to the console, it’s just for human eyes

In this example:

img.addEventListener('click', e => console.dir(e.target))

you mean just the programmer knows the src through the console. But if we need the program to know an image src for using it in a function, what command should we use?

it depends what the function should do

what should this do with e.target? that’s the logic you need there

This code is not from me. I asked someone and he helped me.
The function should know the clicked image URI and name to open it in an image editor on the site.
Which way do you suggest?

I’m sorry, I have no idea