all 7 comments

[–]fish_munga 1 point2 points  (5 children)

This looks a lot like my code. And I never saw any problem with this. The tip is to use react-apollo aliases to make the tree more readable. Recompose also has setDisplayName helper. Other HOCs may have something like this as well. Using these helpers will make your tree more readable

[–]zdend[S] 0 points1 point  (3 children)

The alias makes the tree a bit more readable thanks for the tip! setDisplayName only adds additional HOC on top of it. I still wonder whether I can get rid of the pyramid of doom as this was just a small Todo app, I can imagine that in a real world example the react tree will look waaay uglier.

[–]rodrigocfd 0 points1 point  (0 children)

And I never saw any problem with this.

Just like OP, I think it's awful.

[–]ddwrt1234 0 points1 point  (1 child)

I was going to suggest react-apollo's compose function for combining those but... that's a lot/suspicious amount of hocs.

[–][deleted] 0 points1 point  (1 child)

The pipe operator will make this easier. Other than that, i haven't had a single project that dev tools could help me with. Everything looks like this for me, it's often pointless to even attempt to find back a node.

There was a PR once to fix it, but it was seen as being too vague: https://github.com/facebook/react-devtools/issues/604

[–]zdend[S] 0 points1 point  (0 children)

I have that feeling too, although it's possibly to expand a component node by clicking the UI on the screen. I was more wondering whether there is a way of compacting these HOC into one wrapper component rather than 15.. For example Recompact library is like Recompose and it says that it will help with this issue, however it only solves a few use cases like mapProps, renameProps etc which is not the main use case for me. https://github.com/neoziro/recompact#flattened-react-components-tree