-
Notifications
You must be signed in to change notification settings - Fork 32
Open
Description
Hi!
I'm passing props to my LoadableComponent elements, but those props are also passed to the placeholder div elements so I'm getting some annoying warnings:
Warning: React does not recognize the `myCustomProp` prop on a DOM element.
If you intentionally want it to appear in the DOM as a custom attribute,
spell it as lowercase `myCustomProp` instead. If you accidentally passed it
from a parent component, remove it from the DOM element.
Should be easy enough to remove these warnings by deleting lines 80 and 96 in createLoadableVisibilityComponent.js, but the better way would probably be to extract the className prop and continue to apply it to the placeholder div (i.e., {...props} -> className={props.className}) in case anyone is relying on that functionality (also in your tests, I believe).
Larger code block for context:
if (LoadingComponent || props.fallback) {
return (
<div
style={{
display: "inline-block",
minHeight: "1px",
minWidth: "1px"
}}
className={props.className} #CHANGE: previously {...props}
ref={visibilityElementRef}
>
{LoadingComponent
? React.createElement(LoadingComponent, {
isLoading: true,
...props
})
: props.fallback}
</div>
);
}
return (
<div
style={{ display: "inline-block", minHeight: "1px", minWidth: "1px" }}
className={props.className} #CHANGE: previously {...props}
ref={visibilityElementRef}
/>
);
}Is there another reason for applying the props to the placeholder div elements? Happy to create a PR if you're in agreement.
shinvey
Metadata
Metadata
Assignees
Labels
No labels