mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-27 01:53:48 +01:00
Clear interval when functional connectionBauble gets unmounted
This commit is contained in:
parent
a6ee9a8c76
commit
765cfd0c9a
@ -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>;
|
||||
|
Loading…
Reference in New Issue
Block a user