-
Notifications
You must be signed in to change notification settings - Fork 1
perf: @pureFunctions decorator #63
Comments
Your solution looks definitely easy to use but not very easy to read and may be hard to debug (is it? I wouldn't know how to improve it actually...). Other possible solutions could be:
|
👍 for something like this. Costs: adds an import on "user" component. Pros: makes it explicit we intend to pass a
Seems too much, especially considering the above "tagging" mechanism we should be safe enough |
Added |
naming is misleading probably, but at least it is clear that it builds on top of a pure render implementation. Merge as it is for now |
requirements:
use
@pure
(and potentially any other pure-render tool) correctly whenprops
involve.bind
ed and/orpartial
lly applied functionsi.e: avoid unnecessary re-renderings
see e.g. this for reference: https://discuss.reactjs.org/t/using-function-bind-and-purerendermixin/655
spec proposal:
@pureFunctions
decorator, to be used on top of@pure
should let you pass to
@pureFunctions
-decorated components functions as:instead of
and handle properly the reference for the underlying
@pure
component: reuse cached fn references when fn and args are unchangedThis gives big perf improvements e.g. on LOL/SamplesList for
cellRenderer
andSampleCard.onClick
props@FrancescoCioria @francescogior thoughts about the syntax?
The text was updated successfully, but these errors were encountered: