I'm using a functional component of react, and I'd like to ask how to efficiently deliver functions to events.
See this article at https://reactjs.org/docs/faq-functions.html
According to the official documentation, "Using an arrow function in render creates a new function etch time the component renders, which may break optimizations based on Strictity composite."
If there is no argument passed to the function, I understand that the check1 code is not a good code, is that right?
const Foo = () => {
const example = () => console.log("hi");
return {
<div onClick={() => example()}>click1</div>
<div onClick={example()}>click2</div>
}
}
Is there a difference in performance between click1 and click2?