1

I wonder what is a difference between these two ways of creating a component.

1.

const Something () => {
  const Something2 = () => Something;  
  return (
   <div>
    <Something2 />
   </div>
  )
}

2.

const Something2 = () => Something;  

const Something () => (
   <div>
    <Something2 />
   </div>
  )

I found that question What is difference between those create react component method? on StackOverflow already, but some time has passed and also it's weird for me that as they have written there that there is no performance difference, cause in my opinion in the first case, in every rerender it creates from a scratch whole component.

Samot
  • 103
  • 1
  • 7

0 Answers0