import { useEffect } from "react";
import { useRef, useState } from "react";
import { gql } from "../Actions";
import { connect } from "react-redux";

const Counter = ({ chatId, countMsg }) => {
    // console.log(chatId, countMsg);

    if (!chatId || !countMsg) {
        return <span>0</span>;
    }

    return <span>{countMsg[chatId] || 0}</span>;
};

export const CCounter = connect((s) => ({ countMsg: s.countMsg }))(Counter);
