We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent f6974e2 commit 9ebab38Copy full SHA for 9ebab38
1 file changed
src/RestrictedContent/index.tsx
@@ -38,7 +38,13 @@ const RestrictedContent = forwardRef<
38
percent,
39
}));
40
41
- return cloneElement(Children.only(children), {
+ const child = Children.only(children);
42
+
43
+ if (child?.type === Symbol.for('react.fragment')) {
44
+ throw new Error('RestrictedContent cannot accept a Fragment as a child.');
45
+ }
46
47
+ return cloneElement(child, {
48
ref: contentRef,
49
});
50
0 commit comments