"use client"; import React, { useMemo } from "react"; interface StateItem { state: number | string; text: string; backgroundColor?: string; textColor?: string; } interface PropsStateActive { isBox?: boolean; stateActive: number | string; listState: StateItem[]; } function StateActive({ isBox = true, stateActive, listState, }: PropsStateActive) { // memo trạng thái hiện tại const current = useMemo(() => { return listState.find((item) => item.state === stateActive); }, [stateActive, listState]); if (isBox) { return (
{current?.text ?? "---"}
); } return (
{/* DOT */}
{/* TEXT */}

{current?.text ?? "---"}

); } export default StateActive;