import { useRef } from 'react' ; import uuid from 'uuid' ; import { useHighlightContext , OnHighlightChangeArgs } from './highlight_context' ; export const useHighlightTreeNode = ( ) => { const idRef = useRef < string > ( uuid . v4 ( ) ) ; const { selectedRow , setStore } = useHighlightContext ( ) ; const highlight = ( value ) => { setStore ( { id : idRef . current , ... value } ) ; } ; const isHighlighted = ( ) => { return selectedRow === idRef . current ; } ; return { id : idRef . current , highlight , isHighlighted , } ; } ;