import type { ArrayShape , Dataset , ScalarShape , Value } from '@h5web/shared' ; import type { ReactNode } from 'react' ; import { useDatasetValue } from './hooks' ; interface Props < D extends Dataset > { dataset : D ; selection ? : string ; render : ( val : Value < D > ) => ReactNode ; } function ValueFetcher < D extends Dataset < ArrayShape | ScalarShape > > ( props ) { const { dataset , selection , render } = props ; const value = useDatasetValue ( dataset , selection ) ; return < > { render ( value ) } < />; } export default ValueFetcher ;