iotery-browser-sdk
v1.0.22
Published
iotery.io client javascript SDK
Downloads
8
Readme
iotery.io Client SDK
This library is a client (browser) version of the Iotery Server SDK and should only be used if you know what you are doing.
If you do not have special requirements that would require a client version of the SDK, use the node server SDK.
Usage
import React, { useEffect, useState } from "react";
import logo from "./logo.svg";
import "./App.css";
import Iotery from "iotery-browser-sdk";
const iotery = new Iotery(
"my-api-key"
); //never do this in the browser unless you know what you are doing.
function App() {
const [devices, setDevices] = useState([]);
useEffect(() => {
iotery.getDeviceList().then(res => {
console.log(res);
setDevices(res.results);
});
}, [devices]);
console.log(devices);
return (
<div className="App">
<header className="App-header">
<img src={logo} className="App-logo" alt="logo" />
<p>
{devices.map(d => {
return <div style={{padding:10}}>{d.serial}</div>;
})}
</p>
</header>
</div>
);
}
export default App;