zrok/ui/src/Version.js
2022-08-03 11:54:11 -04:00

24 lines
467 B
JavaScript

import {useEffect, useState} from "react";
import * as metadata from "./api/metadata";
const Version = () => {
const [v, setV] = useState('');
useEffect(() => {
let mounted = true;
metadata.version().then(resp => {
if(mounted) {
setV(resp.data);
}
});
return () => {
mounted = false;
};
}, []);
return (
<p>{v}</p>
);
}
export default Version;