File tree Expand file tree Collapse file tree 2 files changed +7
-7
lines changed Expand file tree Collapse file tree 2 files changed +7
-7
lines changed Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ import APIAddressField from './components/APIAddressField';
10
10
const STORE_RUNTIME = 'runTime' ;
11
11
12
12
function App ( ) {
13
- const waterPumpCtx = useWaterPumpAPI ( ) ;
13
+ const waterPump = useWaterPumpAPI ( ) . API ;
14
14
const [ runTime , setRunTime ] = useState ( 1000 ) ;
15
15
const NotificationsSystem = useNotificationsSystem ( ) ;
16
16
@@ -32,7 +32,7 @@ function App() {
32
32
33
33
const handleStart = async ( ) => {
34
34
try {
35
- await waterPumpCtx . API . start ( runTime ) ;
35
+ await waterPump . start ( runTime ) ;
36
36
NotificationsSystem . alert ( 'Water pump started successfully!' ) ;
37
37
} catch ( error ) {
38
38
NotificationsSystem . alert ( 'Error starting water pump: ' + error . message ) ;
@@ -41,7 +41,7 @@ function App() {
41
41
42
42
const handleStop = async ( ) => {
43
43
try {
44
- await waterPumpCtx . API . stop ( ) ;
44
+ await waterPump . stop ( ) ;
45
45
NotificationsSystem . alert ( 'Water pump stopped successfully!' ) ;
46
46
} catch ( error ) {
47
47
NotificationsSystem . alert ( 'Error stopping water pump: ' + error . message ) ;
Original file line number Diff line number Diff line change 1
1
import React from 'react' ;
2
- import ReactDOM from 'react-dom' ;
3
2
import App from './App.js' ;
4
3
import 'bootstrap/dist/css/bootstrap.min.css' ; // Importing Bootstrap CSS
5
4
6
5
import { NotificationsProvider } from './contexts/NotificationsContext.js' ;
7
6
import { WaterPumpAPIProvider } from './contexts/WaterPumpAPIContext.js' ;
8
7
9
- ReactDOM . render (
8
+ import { createRoot } from 'react-dom/client' ;
9
+ const root = createRoot ( document . getElementById ( 'root' ) ) ;
10
+ root . render (
10
11
< React . StrictMode >
11
12
< NotificationsProvider >
12
13
< WaterPumpAPIProvider >
13
14
< App />
14
15
</ WaterPumpAPIProvider >
15
16
</ NotificationsProvider >
16
- </ React . StrictMode > ,
17
- document . getElementById ( 'root' )
17
+ </ React . StrictMode >
18
18
) ;
You can’t perform that action at this time.
0 commit comments