I think a more general solution for what you’re describing is hoist non react statics. It’ll do this work for you without passing in the compound component props you want (I haven’t tested this case since I’m reading on a phone) but I’ve used this in the past for similar scenarios, and it’s a staple of HOC development for this reason. Because at that point it really is easier and more clear of what’s going on to do:
I think a more general solution for what you’re describing is hoist non react statics. It’ll do this work for you without passing in the compound component props you want (I haven’t tested this case since I’m reading on a phone) but I’ve used this in the past for similar scenarios, and it’s a staple of HOC development for this reason. Because at that point it really is easier and more clear of what’s going on to do:
Instead of:
Hi Devin,
Thank you for sharing! I was not aware of the existence of this package and am really curious to understand how it works below.