Skip to content

How to render an empty node? #85

Answered by ivanceras
Magicloud asked this question in Q&A
Discussion options

You must be logged in to vote

You can either go with:

view_if(self.message.is_some(), {
  node! {
    <div>{text(self.message.unwrap())}</div>
  }
}

or

if let Some(msg) = self.message {
  node! {
    <div>{text(msg)}</div>
  }
} else {
  <span></span>
}

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@Magicloud
Comment options

@ivanceras
Comment options

@Magicloud
Comment options

Answer selected by Magicloud
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants