I love recompose, but when I use it I wind up with stack traces that have lines like:
in withProps(withHandlers(withHandlers(SelectionOverlay))) (created by withState(withProps(withHandlers(withHandlers(SelectionOverlay)))))
Is there any way I can give some sort of "display name" to the individual HOC components to get more readable stack traces?
There is a setDisplayName method available that seems to do what you are asking - https://github.com/acdlite/recompose/blob/master/docs/API.md#setdisplayname
Checkout this section: https://github.com/acdlite/recompose#build-your-own-libraries
I believe you can just assign a static property to your component called displayName and that will be passed through to stack traces as well as the React chrome extension.
So if your HOC is composed like this, you can just write:
const MyComponent = withProps(withHandlers(withHandlers(SelectionOverlay)))
MyComponent.displayName = "ArbitraryValue"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With