qwik
qwik copied to clipboard
[📖] Add documentation on spread operators and destructuring anti-patterns that have negative performance impacts
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 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.
Also see Jermey W's Playground Example on destructuring.
Hi @n8sabes 👋 Wasn't this improved by #2545 ?
According to @mhevery 's demo on the office hours call today it seems like this is no longer an issue (thanks to clever optimizer tricks)