Forwarding Ref
ref 沒辦法用 ...restProps 傳下去
錯誤示範:
function ChildComponent(props) {
return <div {...props} />;
}
const CategoryItem = ({ item, query }) => {
const myRef = useRef();
return (
<ChildComponent ref={myRef} />
);
};
錯誤示範:
function ChildComponent(props) {
return <div {...props} />;
}
const CategoryItem = ({ item, query }) => {
const myRef = useRef();
return (
<ChildComponent ref={myRef} />
);
};