I can't use a single component to render, need to wrap it in additional one
Closed this issue · 2 comments
smolak commented
Hi
When I try to do this:
<Sticky>
{() => {
return <SomeComponent some={prop} />;
}}
</Sticky>
It will fail with Sticky.js:61 Uncaught TypeError: Cannot read property 'getBoundingClientRect' of null
.
But when I do this:
<Sticky>
{() => {
return <div><SomeComponent some={prop} /></div>;
}}
</Sticky>
It works.
It works also when you render a component without props (can have children though):
<Sticky>
{() => {
return <div>Something here</div>;
}}
</Sticky>
It should work forall cases, in my opinion.
dbarbalato commented
Are you using functional components by any chance? This version relies on using a component's ref, and purely functional components do not support refs.
If not, sounds like a legit bug
vcarl commented
Closing due to lack of response. Happy to reopen if the problem isn't because of function components.