Skip to content

minhtaile2712/react-iot-lib

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

react-iot-lib

React library for IoT projects

Usage

In index.js

import { IoTClient, IoTClientProvider } from "react-iot-lib";
import { io } from "socket.io-client";

const host = "http://localhost:5000";
const socket = io(host);
const ioTClient = new IoTClient(socket);

Wrap your App component

<IoTClientProvider client={ioTClient}>
  <App />
</IoTClientProvider>

At component

import { useIoT } from "react-iot-lib";

function Thing() {
  const { data } = useIoT("hello");

  return (
    <div>
      <div>Thing</div>
      <div>{data} </div>
    </div>
  );
}

export default Thing;

About

React library for IoT projects

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published