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');
|
||||
hostname.watch(content => setHostname(content?.trim() ?? ""));
|
||||
return hostname.close;
|
||||
});
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<Card>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue