mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-12-19 04:35:46 +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 { Money } from "../../ui/React/Money";
|
||||||
|
|
||||||
import { dialogBoxCreate } from "../../ui/React/DialogBox";
|
import { dialogBoxCreate } from "../../ui/React/DialogBox";
|
||||||
import { useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
|
|
||||||
export function HospitalLocation(): React.ReactElement {
|
export function HospitalLocation(): React.ReactElement {
|
||||||
/** Stores button styling that sets them all to block display */
|
/** Stores button styling that sets them all to block display */
|
||||||
const btnStyle = { display: "block" };
|
const btnStyle = { display: "block" };
|
||||||
|
|
||||||
const setRerender = useState(false)[1];
|
const setRerender = useState(false)[1];
|
||||||
function rerender(): void {
|
function rerender(): void {
|
||||||
setRerender((old) => !old);
|
setRerender((old) => !old);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
const id = setInterval(rerender, 200);
|
||||||
|
return () => clearInterval(id);
|
||||||
|
}, []);
|
||||||
|
|
||||||
function getHealed(e: React.MouseEvent<HTMLElement>): void {
|
function getHealed(e: React.MouseEvent<HTMLElement>): void {
|
||||||
if (!e.isTrusted) {
|
if (!e.isTrusted) {
|
||||||
return;
|
return;
|
||||||
|
Loading…
Reference in New Issue
Block a user