import { useEffect } from 'react' ; import { Elements } from '../../types' ; import { useStoreState } from '../../store/hooks' ; interface SelectionListenerProps { onSelectionChange : ( elements : Elements | null ) => void ; } export default ( { onSelectionChange } ) => { const selectedElements = useStoreState ( ( s ) => s . selectedElements ) ; useEffect ( ( ) => { onSelectionChange ( selectedElements ) ; } , [ selectedElements ] ) ; return null ; } ;