Skip to content

(react-split): How to handle conditional children #744

@addy

Description

@addy

I've got an issue where the entire Split system isn't being initialized (no gutter present) if the second of my two children is being conditionally rendered.

My second child is rendered asynchronously based on some logic, I would like for the Split system to initialize with the gutter once the second child is rendered.

Basic example would look like this:

<Split>
    <ComponentA />
    {shouldRender && (
        <ComponentB />
    )}
</Split>

Is it possible to do the above without having to do something like this:

<>
    {shouldRender ? (
        <Split>
            <ComponentA />
            <ComponentB />
        </Split>
    ) : (
        <ComponentA />
    )}
</>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions