import React, {useEffect, useState} from 'react';
  import { EVENT_NAMES } from "./../../enums/enums"
import "./style.scss"

const SpeedDigital = (props) => {
    const [speed, setSpeed] = useState(0);

    useEffect(
        () => {
          window.electron.receive(EVENT_NAMES.TELEMETRY_SPEED, (speed) => {
            console.log("speed", speed)
            setSpeed(speed)
          })
          return () => {
          };
        },[]
      );
    return (
        <div className="speed-digital"> 
            <div className="speed-digital__speed">
                <div>{speed.value}</div>
                <div>km/h</div>
            </div>
            
        </div>
    );
}

export default SpeedDigital;