0.1.1 • Published 4 years ago

react-mqtt-controls v0.1.1

Weekly downloads
68
License
-
Repository
-
Last release
4 years ago

A collection of React components to interact with MQTT.

Usage

First of all you need to wrap your app in a MqttConnection component, after that, you can use the MqttComponent component to turn any component with an onChange(event, value)prop into an MQTT connected control.

Documentation here

Example

import React from 'react';
import ReactDOM from 'react-dom';
import {
    MqttConnection,
    MqttComponent,
    Button
} from 'react-mqtt-controls';

const App = () => {
    return (
	<MqttConnection config={{url: 'mqtt://localhost:9001'}}>
	    <MqttComponent
		component={Button}
		topic="/my/mqtt/topic"
		componentProps={{
		    value: "hello"
		}}

		publishOptions={{
		    qos: 0,
		    retain: true
		}}

		noRBE
	    >
		Button Text
	    </MqttComponent>
	</MqttConnection>
    )
}; 

ReactDOM.render(<App />, document.getElementById('app'));
0.1.1

4 years ago

0.1.0

4 years ago

0.0.15

4 years ago

0.0.14

4 years ago

0.0.13

4 years ago

0.0.12

4 years ago

0.0.10

4 years ago

0.0.11

4 years ago

0.0.9

4 years ago

0.0.8

4 years ago

0.0.7

4 years ago

0.0.6

4 years ago

0.0.5

4 years ago

0.0.4

4 years ago

0.0.3

4 years ago

0.0.2

4 years ago

0.0.1

4 years ago