MCPcopy Create free account
hub / github.com/bitmap/react-hook-inview / ComponentWithRoot

Function ComponentWithRoot

src/__tests__/useInView.test.tsx:116–132  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

114
115 test("root option", async () => {
116 const ComponentWithRoot: React.FC = () => {
117 const rootRef = useRef<HTMLDivElement | null>(null);
118
119 const [ref, ,, observer] = useInView({
120 root: rootRef.current,
121 });
122 const root = observer?.root;
123 const text = !!root;
124
125 return (
126 <div ref={rootRef}>
127 <div ref={ref}>
128 {text.toString()}
129 </div>
130 </div>
131 );
132 };
133
134 const { getByText } = render(<ComponentWithRoot />);
135

Callers

nothing calls this directly

Calls 1

useInViewFunction · 0.85

Tested by

no test coverage detected