Skip to content

[BUG] Rendering in non browser environment (JSDOM) #18

@pbrzosko

Description

@pbrzosko

When I am using portal component in a non browser environment, element in here is null:

const [ele] = React.useState(() => {
    if (!canUseDom()) {
      return null;
    }

And then this code fails because ele is null:

function cleanup() {
    ele.parentElement?.removeChild(ele);

    appendedRef.current = false;
  }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions