This PR and PR #783 added new utility render-functions inside RenderContext.
The renderIf(predicate: (V) -> Boolean) function only renders the given content, when the given predicate returns true for the value inside the Flow<V>.
val store = storeOf<String>("foo")
render {
store.data.renderIf(String::isNotBlank) {
p { +it }
}
}
The renderNotNull() function only renders the given content, when the value inside the Flow<V?> is not null.
val store = storeOf<String?>(null)
render {
store.data.renderNotNull {
p { +it }
}
}
The renderIs(klass: KClass<W>) function only renders the given content, when the value inside the Flow<V> is a type of klass.
interface I
class A: I
class B: I
val store = storeOf<I>(A())
render {
store.data.renderIs(A::class) {
p { +"A" }
}
}
Extends the PR #783 from @serras. Thanks for your work!
This PR and PR #783 added new utility
render
-functions insideRenderContext
.The
renderIf(predicate: (V) -> Boolean)
function only renders the givencontent
, when the givenpredicate
returnstrue
for the value inside theFlow<V>
.The
renderNotNull()
function only renders the givencontent
, when the value inside theFlow<V?>
is not null.The
renderIs(klass: KClass<W>)
function only renders the givencontent
, when the value inside theFlow<V>
is a type ofklass
.Extends the PR #783 from @serras. Thanks for your work!