import React, { useLayoutEffect, useRef, useState } from 'react'; import { findParentBackgroundColor } from '../helpers'; import { Box } from './YAxisBackground.styled'; export const YAxisBackground: React.FunctionComponent> = ( props, ) => { const [background, setBackground] = useState('transparent'); const elementRef = useRef(null); useLayoutEffect(() => { if (elementRef.current) { setBackground(findParentBackgroundColor(elementRef.current)); } }, []); return ; };