Skip to content

Commit f4785ce

Browse files
committed
add useEffect
1 parent 6023b36 commit f4785ce

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/App.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { useState } from 'react';
1+
import React, { useState, useEffect } from 'react';
22
import './App.css';
33
import { makeStyles } from '@material-ui/core/styles';
44
import { AppBar, Typography, Button, Toolbar, Grid, Slide, Dialog, DialogActions, DialogContent, DialogTitle, IconButton, Menu, MenuItem } from '@material-ui/core';
@@ -96,8 +96,10 @@ function App() {
9696
} catch (error) {
9797
console.error("Error checking for updates:", error);
9898
}
99-
}
100-
checkForUpdates();
99+
}
100+
useEffect(() => {
101+
checkForUpdates(); // Run after UI has fully loaded.
102+
}, []);
101103
return (
102104
<ThemeProvider theme={theme}>
103105
<div>

0 commit comments

Comments
 (0)