You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It is super common to spread properties into a component <Foo {...bar} /> as it's the obvious pattern to pass a collection of indeterminate properties. It is also super common to destructure props into a component function's arguments component$(({foo, bar}: Props) => to create cleaner looking code.
However, based on this discussion, these cause unnecessary rendering cycles.
A documentation section with these anti-patterns would be of value, and "why" it has this cost impact to help improve developer's mental model of Qwik. I use this pattern often and had no idea of the render cost until the conversation in Discord.
Suggestion
It is super common to spread properties into a component
<Foo {...bar} />
as it's the obvious pattern to pass a collection of indeterminate properties. It is also super common to destructure props into a component function's argumentscomponent$(({foo, bar}: Props) =>
to create cleaner looking code.However, based on this discussion, these cause unnecessary rendering cycles.
A documentation section with these anti-patterns would be of value, and "why" it has this cost impact to help improve developer's mental model of Qwik. I use this pattern often and had no idea of the render cost until the conversation in Discord.
Also see Jermey W's Playground Example on destructuring.
The text was updated successfully, but these errors were encountered: