How to use the react-dom.unmountComponentAtNode function in react-dom

To help you get started, weโ€™ve selected a few react-dom examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github atom / github / lib / atom-items / file-patch-pane-item.js View on Github external
destroy() {
    // TODO: is this right?
    this.emitter.emit('did-destroy');
    this.emitter.dispose();
    ReactDom.unmountComponentAtNode(this.getElement());
  }
}
github storybookjs / storybook / app / react / src / client / preview / render.ts View on Github external
export default async function renderMain({
  storyFn,
  selectedKind,
  selectedStory,
  showMain,
  forceRender,
}: RenderMainArgs) {
  const element = storyFn();

  // We need to unmount the existing set of components in the DOM node.
  // Otherwise, React may not recreate instances for every story run.
  // This could leads to issues like below:
  // https://github.com/storybookjs/react-storybook/issues/81
  // But forceRender means that it's the same story, so we want too keep the state in that case.
  if (!forceRender) {
    ReactDOM.unmountComponentAtNode(rootEl);
  }

  await render(element, rootEl, { name: selectedStory, kind: selectedKind });
  showMain();
}
github mobxjs / mobx-devtools / src / frontend / index.jsx View on Github external
const reload = () => {
    ReactDOM.unmountComponentAtNode(config.node);
    setTimeout(() => {
      // for some reason React 16 does unmountComponentAtNode asynchronously (?)
      config.node.innerHTML = '';
      render();
    }, 0);
  };
github react-component / m-picker / tests / boilerplate.spec.js View on Github external
afterEach(function() {
    ReactDOM.unmountComponentAtNode(div);
    document.body.removeChild(div);
  });
github threepointone / routah / tests / index.js View on Github external
  afterEach(() => unmountComponentAtNode(node))
github PaulLaux / eth-hot-wallet / app / app.js View on Github external
module.hot.accept(['containers/App'], () => {
    ReactDOM.unmountComponentAtNode(MOUNT_NODE);
    render();
  });
}
github instructure / instructure-ui / docs / app / lib / components / ComponentExample / ComponentExample.js View on Github external
executeCode (code, variant) {
    const mountNode = this.refs.mount

    ReactDOM.unmountComponentAtNode(mountNode)

    this.setState({
      error: null,
      variant
    })

    if (!code) {
      return
    }

    try {
      const compiledCode = this.compileCode(code)
      const component = this.evalCode(compiledCode)

      ReactDOM.render(component, mountNode)
    } catch (err) {
github NSFI / ppfish-components / source / utils / ContainerRender.js View on Github external
removeContainer = () => {
    if (this.container) {
      ReactDOM.unmountComponentAtNode(this.container);
      this.container.parentNode.removeChild(this.container);
      this.container = null;
    }
  }
github elastic / kibana / src / legacy / core_plugins / kibana / public / management / sections / index_patterns / edit_index_pattern / create_edit_field / create_edit_field.js View on Github external
const destroyFieldEditor = () => {
  const node = document.getElementById(REACT_FIELD_EDITOR_ID);
  node && unmountComponentAtNode(node);
};
github XiaoMi / hiui / components / tooltip / index.js View on Github external
function deprecatedClose () {
    mountNode && unmountComponentAtNode(mountNode)
    mountNode = undefined
  }
  return { close: deprecatedClose }