import { PageProps } from '@adonisjs/inertia/types'; import { usePage } from '@inertiajs/react'; import { CollectionWithLinks } from '~/types/app'; interface UseCollectionsProps { collections: CollectionWithLinks[]; } export const useCollections = () => { const { props } = usePage(); return props.collections; }; export type WithCollectionsProps = { collections: CollectionWithLinks[]; }; export const withCollections = ( Component: React.ComponentType ): React.ComponentType> => { return (props: Omit) => { const collections = useCollections(); return ; }; };