import { useContext , useEffect } from 'react' ; import { CytoscapeContext } from '../Cytoscape' ; export function Centerer ( ) { const cy = useContext ( CytoscapeContext ) ; useEffect ( ( ) => { if ( cy ) { cy . one ( 'layoutstop' , ( event ) => { event . cy . animate ( { duration : 50 , center : { eles : '' } , fit : { eles : '' , padding : 50 } , } ) ; } ) ; } } , [ cy ] ) ; return null ; }