Hi,
Thanks for the library! I am running into issues with useReceivePeerState and React w/ hooks. It seems that the state variable returned from useReceivePeerState does not update when there is new data on the channel. However, refreshing the page causes the latest data to be loaded. My receiver code is pretty much identical to your sample:
function Recv() {
const urlParams = new URLSearchParams(window.location.search);
const brokerId = urlParams.get("broker")!;
const [state, isConnected, error] = useReceivePeerState<string>(brokerId);
return (
<h1>{state}</h1>
);
}
export default Recv;
So, this code only works when manually refreshing the page. It does cause a re-render when new data is sent from the peer.
Hi,
Thanks for the library! I am running into issues with
useReceivePeerStateand React w/ hooks. It seems that thestatevariable returned fromuseReceivePeerStatedoes not update when there is new data on the channel. However, refreshing the page causes the latest data to be loaded. My receiver code is pretty much identical to your sample:So, this code only works when manually refreshing the page. It does cause a re-render when new data is sent from the peer.