Use React Context API
This commit is contained in:
parent
3b78a4d8ad
commit
df237ef336
7 changed files with 90 additions and 72 deletions
12
src/mqtt/context.js
Normal file
12
src/mqtt/context.js
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
// @flow
|
||||
import React from "react";
|
||||
|
||||
export type MqttContextValue = {
|
||||
state: State,
|
||||
changeState: (topic: string, value: string) => void
|
||||
};
|
||||
|
||||
export default React.createContext({
|
||||
state: {},
|
||||
changeState: (_topic, _val) => {}
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue