import React, { useState } from 'react'; import { useSelector, useDispatch } from 'react-redux/'; export default function Test() { const comConnection = useSelector((state) => state.comConnectionReducer); const [comData, setComData] = useState(''); comConnection.parser.on('data', (data) => { setComData(data); }); const triggerOn = () => { comConnection.port.write('on'); }; const triggerOff = () => { comConnection.port.write('off'); }; const triggerOne = () => { comConnection.port.write('0'); }; const triggerTwo = () => { comConnection.port.write('1'); }; return (

{comData}

); }