title: How to use an if within a map in react.js?
body: <p>I have this function where I have this piece of code, but it does not return anything, just leave blank</p>
  
  <pre><code>mostrarPostsNoValidos() {
      if(this.state.posts.length &gt; 0) {
          this.state.posts.map((post, key) =&gt; {
              if(post.validado === "0"){
                  return (
                      &lt;a href={`/post/${post.id}/${post.slug}`} key={key}&gt;
                          &lt;div className="card post"&gt;
                              &lt;div className="card-body"&gt;
                                  {post.titulo}
                              &lt;/div&gt;
                          &lt;/div&gt;
                      &lt;/a&gt;
                  );
              }
          });
      } else {
          return &lt;h3&gt;No hay posts que mostrar aún&lt;/h3&gt;
      }
  }
  </code></pre>