0

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?

Hyeongrok
  • 31
  • 1
  • 5
  • You asked this [question](https://stackoverflow.com/q/73597471/11887902) 6h ago, and I answered you. – Mina Sep 04 '22 at 13:52

0 Answers0