Say I have a functional component:
const Foo = (props) => ( <div>{props.name}</div> );
What is the difference between calling it directly as a function:
const fooParent = () => (
<div> {Foo({ name: "foo" })} </div>
)
versus calling it as a component:
const fooParent = () => (
<div> <Foo name="foo"/> </div>
)
I'm mostly interested in performance implications, how React treats them differently internally, and perhaps how things might be different in React Fiber, where I hear functional components got a performance boost.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…