React Functional component: calling as function vs. as component

If you call functional component directly, you are calling a custom hook actually.

example:

function A() {
  const [state] = useState([])
  return (
    <div>{state}</div>
  )
}

A()
<A />

If you call A(), the state mounts in parent fiber, but if you use <A />, React will call createElement to create a new fiber on which to mount state.

Leave a Comment