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

    Function getRenderInContainer

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

      If an element has a key, then the rendered element would update the already rendered element with the same key.

      If there's no key, then a new element would be rendered on each function call.

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

      Parameters

      Returns RenderInContainerCallback

      A function that renders/re-renders an element.

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

      // 2. Render a 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>);