eugene
eugene

Reputation: 41785

Semantic UI react, render dropdown/modal only when it's visible?

Is there a way to delay rendering of content of dropdown/modal until it is open?

I see they are being rendered even if they are not visible until user clicks to see its contents.

Upvotes: 0

Views: 1280

Answers (1)

Oleksandr Fediashov
Oleksandr Fediashov

Reputation: 4335

The Modal component uses Portal for rendering content, while Portal renders something only if it's open. This means that the component already satisfies your conditions.

With the Dropdown component, it will be more difficult. You can control it yourself, but it means that you will need to process all events self-consciously and it will be not easy.

<Dropdown open={true} options={open && options} />

Upvotes: 1

Related Questions