React Hookers - v6.3.0
    Preparing search index...

    Function getRenderInContainer

    • Returns a function that renders or re-renders an element in a container.

      If an element has a key, rendering updates the already rendered element with the same key.

      If there is no key, a new element is rendered on each call.

      Use the useCloseHandler hook in a rendered component to obtain a callback that unmounts the rendered element.

      Parameters

      Returns RenderInContainerCallback

      A function that renders or re-renders an element.

      // 1. Create a container
      const MyContainer = createRenderContainer();

      // 2. Render the container somewhere
      <MyContainer />

      // 3. Get a function that renders an element in the container
      const renderInContainer = getRenderInContainer(MyContainer);

      // 4. Render an element in the container
      const unmount = renderInContainer(<div>Hello</div>);