0.1.1 • Published 5 years ago

react-mqtt-controls v0.1.1

Weekly downloads
68
License
-
Repository
-
Last release
5 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

5 years ago

0.1.0

5 years ago

0.0.15

5 years ago

0.0.14

5 years ago

0.0.13

5 years ago

0.0.12

5 years ago

0.0.10

5 years ago

0.0.11

5 years ago

0.0.9

5 years ago

0.0.8

5 years ago

0.0.7

5 years ago

0.0.6

5 years ago

0.0.5

5 years ago

0.0.4

5 years ago

0.0.3

5 years ago

0.0.2

5 years ago

0.0.1

5 years ago