Skip to content

Commit

Permalink
remove unused WithClerk component
Browse files Browse the repository at this point in the history
  • Loading branch information
BRKalow committed Dec 17, 2024
1 parent a2b3f14 commit 044001a
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 20 deletions.
18 changes: 0 additions & 18 deletions packages/react/src/components/withClerk.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ import type { LoadedClerk, Without } from '@clerk/types';
import React from 'react';

import { useIsomorphicClerkContext } from '../contexts/IsomorphicClerkContext';
import { errorThrower } from '../errors/errorThrower';
import { hocChildrenNotAFunctionError } from '../errors/messages';
import { useAssertWrappedByClerkProvider } from '../hooks/useAssertWrappedByClerkProvider';

export const withClerk = <P extends { clerk: LoadedClerk; component?: string }>(
Expand Down Expand Up @@ -37,19 +35,3 @@ export const withClerk = <P extends { clerk: LoadedClerk; component?: string }>(
HOC.displayName = `withClerk(${displayName})`;
return HOC;
};

export const WithClerk: React.FC<{
children: (clerk: LoadedClerk) => React.ReactNode;
}> = ({ children }) => {
const clerk = useIsomorphicClerkContext();

if (typeof children !== 'function') {
errorThrower.throw(hocChildrenNotAFunctionError);
}

if (!clerk.loaded) {
return null;
}

return <>{children(clerk as unknown as LoadedClerk)}</>;
};
2 changes: 0 additions & 2 deletions packages/react/src/errors/messages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ export const noClerkProviderError = 'You must wrap your application in a <ClerkP
export const multipleClerkProvidersError =
"You've added multiple <ClerkProvider> components in your React component tree. Wrap your components in a single <ClerkProvider>.";

export const hocChildrenNotAFunctionError = 'Child of WithClerk must be a function.';

export const multipleChildrenInButtonComponent = (name: string) =>
`You've passed multiple children components to <${name}/>. You can only pass a single child component or text.`;

Expand Down

0 comments on commit 044001a

Please sign in to comment.