-
Notifications
You must be signed in to change notification settings - Fork 0
Menu
marek edited this page Sep 16, 2025
·
4 revisions
TBD
const { deleteRootMenuItem, addRootMenuItem } = useMenu();
const item = createNewRootMenuItem();
useEffect(() => {
addRootMenuItem(item );
return () => {
deleteRootMenuItem(item .id);
};
}, []);
const { retrieveIdByTitle, deleteRootMenuItem, addRootMenuItem } = useMenu();
const deletedRef = useRef<RootMenuItem | undefined>(undefined);
useEffect(() => {
const id = retrieveIdByTitle("Help");
if (id) {
deletedRef.current = deleteRootMenuItem(id);
}
}, [retrieveIdByTitle, deleteRootMenuItem]);
useEffect(() => {
return () => {
if (deletedRef.current) {
addRootMenuItem(deletedRef.current);
}
};
}, []);