sycamore-rs / sycamore

A library for creating reactive web apps in Rust and WebAssembly
https://sycamore-rs.netlify.app
MIT License
2.79k stars 148 forks source link

Empty false condition for builder `dyn_if` #604

Closed dessalines closed 3 weeks ago

dessalines commented 1 year ago

I often only want to show something in the true condition, but the dyn_if function has three arguments:

The false case should probably either be an Option type, or there should be a helper function that is just empty html.

Currently I'm doing:

.dyn_if(|| condition, || ..., || fragment([]) as a workaround.