meteor / react-packages

Meteor packages for a great React developer experience
http://guide.meteor.com/react.html
Other
574 stars 159 forks source link

[WIP] Add a shouldUpdate option to useTracker #281

Closed CaptainN closed 4 years ago

CaptainN commented 4 years ago

Change the third parameter (currently undocumented) to accept an option object with two optional nodes - shouldUpdate and the already present computationHandler. This proposed change would make it possible to reduce rerenders by providing a comparison function, to check old values, with new values.

@menelike

CaptainN commented 4 years ago

I'd actually like to make this an optional 2nd OR 3rd argument. The second argument is a deps array, but I'd like to be able to accept a config object instead (overload style). This might make sense to do after the Typescript conversion lands, since there's now a split in the two versions of the hook - with/without deps, and the overload decision can be cleaning implemented there.