Answer the question
In order to leave comments, you need to log in
How to specify a condition in react so that dom elements are accessed after the component is loaded?
React application, functional components, not class components, pages in the application are made using GoldenLayout layers. When filling out the form on the main page, a transition occurs and others appear. On the main page, I need to remove the resize icon (which is in the upper right corner), but leave it on the others. The pages are interconnected through config, so just removing the icon in config does not work through the following code (icons disappear from all pages)
settings: {
showMaximiseIcon: false,
}
useHideResizeControl('Прокси-модели');
export const useHideResizeControl = name => {
useMemo(() => {
(window.onload = () => {
const resizeControl = document.querySelector(`[title="${name}"]`)?.parentNode?.parentNode;
if (resizeControl) {
resizeControl.children[1].children[1].style.display = 'none';
}
})();
}, [name]);
};
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question