Skip to content

Instantly share code, notes, and snippets.

@jenschr
Created November 2, 2021 14:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jenschr/38dd531c3c64edb04cb52ea1fd847c82 to your computer and use it in GitHub Desktop.
Save jenschr/38dd531c3c64edb04cb52ea1fd847c82 to your computer and use it in GitHub Desktop.
import React from 'react';
import { useMqttState } from 'mqtt-react-hooks';
export default function Status() {
/*
* Status list
* - Offline
* - Connected
* - Reconnecting
* - Closed
* - Error: printed in console too
*/
const { connectionStatus } = useMqttState();
return <h1>{`Status: ${connectionStatus}`}</h1>;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment