refactor(resizeObserver): check if available

This commit is contained in:
moklick
2020-12-01 12:04:13 +01:00
parent 017d8222d9
commit 887ffbd0c4
3 changed files with 16 additions and 14 deletions
+2 -2
View File
@@ -167,9 +167,9 @@ export default (NodeComponent: ComponentType<NodeComponentProps>) => {
useEffect(() => {
if (nodeElement.current) {
const currNode = nodeElement.current;
resizeObserver.observe(currNode);
resizeObserver?.observe(currNode);
return () => resizeObserver.unobserve(currNode);
return () => resizeObserver?.unobserve(currNode);
}
return;