souporserious/react-measure

Remove children: PropTypes.func in withContentRect()

Closed this issue · 2 comments

jpolo commented

This prop typing is only valid for component. I use withContentRect() with a component (successfully) and the type of children is a regular react-fragment

I agree that children shouldn't need to be a function. currently doing {(arg) => <Child prop={arg} />} to work around this, but I think there are more performant ways of rendering children dynamically at this point in react

I'd like to see this as well. I'm using recompose and it gives me a warning when I try to compose withContentRect() -- unless it's the last higher-order component I compose and I use the workaround that @dkrieger mentioned. I'll throw up a quick PR for it.