How to use the react-reconciler/inline.test.updateContainer function in react-reconciler

To help you get started, we’ve selected a few react-reconciler 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 facebook / react / packages / react-test-renderer / src / ReactTestRenderer.js View on Github external
isConcurrent = true;
      }
    }
    let container = {
      children: [],
      createNodeMock,
      tag: 'CONTAINER',
    };
    let root: FiberRoot | null = createContainer(
      container,
      isConcurrent ? ConcurrentRoot : LegacyRoot,
      false,
      null,
    );
    invariant(root != null, 'something went wrong');
    updateContainer(element, root, null, null);

    const entry = {
      _Scheduler: Scheduler,

      root: undefined, // makes flow happy
      // we define a 'getter' for 'root' below using 'Object.defineProperty'
      toJSON(): Array | ReactTestRendererNode | null {
        if (root == null || root.current == null || container == null) {
          return null;
        }
        if (container.children.length === 0) {
          return null;
        }
        if (container.children.length === 1) {
          return toJSON(container.children[0]);
        }
github facebook / react / packages / react-test-renderer / src / ReactTestRenderer.js View on Github external
update(newElement: React$Element) {
        if (root == null || root.current == null) {
          return;
        }
        updateContainer(newElement, root, null, null);
      },
      unmount() {
github facebook / react / packages / react-test-renderer / src / ReactTestRenderer.js View on Github external
unmount() {
        if (root == null || root.current == null) {
          return;
        }
        updateContainer(null, root, null, null);
        container = null;
        root = null;
      },
      getInstance() {