Skip to content
Source
Sign inSign up
TanStack/router
Open History to see the last commit

circular-reference-arrow-function.tsx

25 lines535 Bytes

1import { createFileRoute } from '@tanstack/react-router'
2​
3function getComponentName(obj: Record<string, unknown>): string {
4 return Object.keys(obj)[0]
5}
6​
7const App = () => {
8 const componentName = getComponentName({ App })
9​
10 return (
11 <div>
12 Component Name is {componentName}
13 <OtherComponent />
14 </div>
15 )
17​
18function OtherComponent() {
19 const componentName = getComponentName({ App })
20 return <div>App component name is {componentName}</div>
22​
23export const Route = createFileRoute('/')({
24 component: App,
25})