-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
what about if-else ? #7
Comments
Currently you will need to do the opposite logic for an else: renderIf(collection.length > 0)(
<List collection={collection} />
)
renderIf(collection.length === 0)(
<EmptyState />
) "if-else" is a bit tricky in how this module works. If we were to implement it, I'd also want to implement "else if", which makes it even trickier |
thanks |
@ajwhite I just made a temporary if-else version, as it helped us replace any ternary operators. https://github.com/sundeepnarang/render-ifelse will keep looking forward to your version with else-if support. |
I've put together a solution for this in #13 Basic usage: <div>
{renderIf.if(x === 1) (
<span>Hello, 1</span>
).elseIf(x === 2) (
<span>Hello, 2</span>
).elseIf(x === 3) (
<span>Hello, 3</span>
).else(
<span>Hello, {x}</span>
).evaluate()}
</div> I welcome any feedback |
how to use 'else' condition? Thanks
The text was updated successfully, but these errors were encountered: