mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-12-18 20:25:45 +01:00
Update HospitalLocation.tsx
Add auto-refreshing to the component
This commit is contained in:
parent
1b61ec0e12
commit
baa149fa80
@ -12,17 +12,21 @@ import { getHospitalizationCost } from "../../Hospital/Hospital";
|
||||
import { Money } from "../../ui/React/Money";
|
||||
|
||||
import { dialogBoxCreate } from "../../ui/React/DialogBox";
|
||||
import { useState } from "react";
|
||||
import { useEffect, useState } from "react";
|
||||
|
||||
export function HospitalLocation(): React.ReactElement {
|
||||
/** Stores button styling that sets them all to block display */
|
||||
const btnStyle = { display: "block" };
|
||||
|
||||
const setRerender = useState(false)[1];
|
||||
function rerender(): void {
|
||||
setRerender((old) => !old);
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
const id = setInterval(rerender, 200);
|
||||
return () => clearInterval(id);
|
||||
}, []);
|
||||
|
||||
function getHealed(e: React.MouseEvent<HTMLElement>): void {
|
||||
if (!e.isTrusted) {
|
||||
return;
|
||||
|
Loading…
Reference in New Issue
Block a user