Hello! I have a question about .render() method.
A render method is a property whose name is
render , and whose value is a function.
How can I understand “value of the render method is a function”? And why render method here called as render function if its a method? Also I wanted to ask why do we use “return” in the method?
Thank you in advance
the MDN documentation:
formulates it better:
A method is a function associated with an object, or, simply put, a method is a property of an object that is a function.
Methods are also properties.
You have learned JS before starting reactJS, right? Well, we need to return what we want to render on the page.
Actually I always used console.log() in methods, so thats why I asked about using return in methods) I usually use return in functions and conole.log() in methods, so thats why I was confused
.log() logs something to the console.
return hands back data to the caller.
given the log method and return keyword achieve very different things, they are not interchangeable.