How to use rax-unmount-component-at-node - 4 common examples

To help you get started, we’ve selected a few rax-unmount-component-at-node 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 alibaba / rax / packages / rax-create-portal / src / __tests__ / createPortal.js View on Github external
it('should render one portal', () => {
    const container = createNodeElement('div');
    const portalContainer = createNodeElement('div');

    render(
      <div>{createPortal(<div>portal</div>, portalContainer)}</div>,
      container
    );

    jest.runAllTimers();
    expect(container.childNodes[0].tagName).toBe('DIV');
    expect(portalContainer.childNodes[0].childNodes[0].data).toBe('portal');

    unmountComponentAtNode(container);

    expect(container.childNodes.length).toBe(0);
    expect(portalContainer.childNodes.length).toBe(0);
  });
github alibaba / rax / packages / rax-find-dom-node / src / __tests__ / findDOMNode.js View on Github external
it('findDOMNode should reject unmounted objects with render func', function() {
    class Foo extends Component {
      render() {
        return <div>;
      }
    }

    let container = createNodeElement('div');
    var inst = render(, container);
    unmountComponentAtNode(container);

    expect(() =&gt; findDOMNode(inst)).toThrowError(
      'findDOMNode: find on an unmounted component.'
    );
  });
</div>
github alibaba / rax / packages / rax-create-portal / src / index.js View on Github external
componentWillUnmount() {
    unmountComponentAtNode(this.props.container);
  }
github alibaba / rax / packages / rax-create-portal / src / index.js View on Github external
componentDidUpdate(prevProps) {
    if (prevProps.container !== this.props.container) {
      unmountComponentAtNode(prevProps.container);
    }

    this.renderPortal();
  }

rax-unmount-component-at-node

rax-unmount-component-at-node

BSD-3-Clause
Latest version published 5 years ago

Package Health Score

53 / 100
Full package analysis

Popular rax-unmount-component-at-node functions

Similar packages