simplyfy code svg value mqtt
This commit is contained in:
@@ -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);
|
||||
}}
|
||||
/>
|
||||
</>
|
||||
|
||||
Reference in New Issue
Block a user