const listRef = useRef();
<InfiniteLoader>
(({ref}) => {
ref(listRef); // Set infinite loader ref
return (
<DynamicList ref={listRef} /> // Set dynamic list ref
);
})
</InfiniteLoader>
So that means dynamic list accepts ref as input as seen in example 2 but does not return localRef as output as seen in in example 1. Getting the ref with an arrow function is a common pattern in React though. Could this be added or clarified in the documentation?
I had the following (simplified) code:
But dynamic list gave errors about the internal
listRef.current
being undefined.This also happens when you try to just use the ref from infinite loader for example:
In the end I solved this issue like this:
So that means dynamic list accepts ref as input as seen in example 2 but does not return
localRef
as output as seen in in example 1. Getting the ref with an arrow function is a common pattern in React though. Could this be added or clarified in the documentation?