simplyfy code svg value mqtt

This commit is contained in:
2025-09-29 16:38:00 +07:00
parent 6de6d35a6b
commit b73abf2fa2
2 changed files with 23 additions and 37 deletions

View File

@@ -1,7 +1,7 @@
import { useEffect, useState } from 'react';
import { Card, Typography, Flex } from 'antd';
import { ReactSVG } from 'react-svg';
import { listenMessageState, setValSvg } from '../../components/Global/MqttConnection';
import { setValSvg } from '../../components/Global/MqttConnection';
const { Text } = Typography;
@@ -9,12 +9,6 @@ const filePathSvg = '/svg/test-new.svg';
const topicMqtt = 'PIU_GGCP/Devices/PB';
const SvgTest = () => {
const [received, setReceived] = useState([]);
listenMessageState(setReceived)
useEffect(() => {}, []);
return (
<>
<Card>
@@ -27,7 +21,7 @@ const SvgTest = () => {
<ReactSVG
src={filePathSvg}
beforeInjection={(svg) => {
setValSvg(received, topicMqtt, svg);
setValSvg(topicMqtt, svg);
}}
/>
</>