diff --git a/src/ArcherContainer.js b/src/ArcherContainer.js index ffa8c28..2174249 100644 --- a/src/ArcherContainer.js +++ b/src/ArcherContainer.js @@ -198,7 +198,9 @@ export class ArcherContainer extends React.Component { unregisterChild = (id: string): void => { this.setState((currentState: State) => { - currentState.observer.unobserve(currentState.refs[id]); + if (currentState.refs[id]) { + currentState.observer.unobserve(currentState.refs[id]); + } const newRefs = { ...currentState.refs }; delete newRefs[id]; return { refs: newRefs };