Add empty dependency array to useEffect hook
This limits the file watch listener to only attach once and not on every render which is unnecessary.
This commit is contained in:
parent
b37df688b2
commit
ddcf092678
1 changed files with 1 additions and 1 deletions
|
|
@ -32,7 +32,7 @@ export const Application = () => {
|
||||||
const hostname = cockpit.file('/etc/hostname');
|
const hostname = cockpit.file('/etc/hostname');
|
||||||
hostname.watch(content => setHostname(content?.trim() ?? ""));
|
hostname.watch(content => setHostname(content?.trim() ?? ""));
|
||||||
return hostname.close;
|
return hostname.close;
|
||||||
});
|
}, []);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Card>
|
<Card>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue