simbathesailor / use-what-changed

A React hook and an easy to use babel-pugin to debug various React official hooks
https://codesandbox.io/s/simabthesailoruse-what-changed-demo-q94rn
MIT License
658 stars 12 forks source link

Request: way to format printed output? #60

Open Benjin opened 7 months ago

Benjin commented 7 months ago

UWC is correctly detecting when dependencies change, but for some data types, e.g. functions or those without a useful toString(), it'd be nice to be able to supply a function to format the printed UWC output.

Proposals:

useWhatChanged([person, (x) => x.FullName], [place, null);

or

useWhatChanged([person, place], [(person) => person.FullName, null]);

In both cases, person has their print overridden to display the FullName property and place is left to its default.