mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2026-04-17 06:48:42 +02:00
Clear interval when functional connectionBauble gets unmounted
This commit is contained in:
@@ -8,9 +8,10 @@ export const ConnectionBauble = (props: baubleProps): React.ReactElement => {
|
||||
const [connection, setConnection] = useState(props.callback());
|
||||
|
||||
useEffect(() => {
|
||||
setInterval(() => {
|
||||
const timer = setInterval(() => {
|
||||
setConnection(props.callback());
|
||||
}, 1000);
|
||||
return () => clearInterval(timer);
|
||||
});
|
||||
|
||||
return <div className="ConnectionBauble">{connection ? "Connected" : "Disconnected"}</div>;
|
||||
|
||||
Reference in New Issue
Block a user