(path = "", props?: any)
| 14 | }; |
| 15 | |
| 16 | export const Component = (path = "", props?: any): React.ReactNode => { |
| 17 | if (!path) return null; |
| 18 | |
| 19 | let importFn = Pages[`/src${path}.tsx`]; |
| 20 | if (!importFn) importFn = Pages[`/src${path}/index.tsx`]; |
| 21 | if (!importFn) { |
| 22 | console.warn("Component not found for path:", path); |
| 23 | return null; |
| 24 | } |
| 25 | |
| 26 | let Element = lazyComponentCache.get(path); |
| 27 | if (!Element) { |
| 28 | Element = lazy(importFn as any); |
| 29 | lazyComponentCache.set(path, Element); |
| 30 | } |
| 31 | return <Element {...props} />; |
| 32 | }; |
no test coverage detected