mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-12-23 22:52:29 +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