title: How to add a specific message when an array length is 0?
body: <p>I'm trying to do something in a personal React project. So, I have a list of locations and a search input. When I'm entering something in that input and nothing is found in my locations array I want to show a message like &quot;No result found!&quot;. I know how to do this just when I don't use that filter thing.</p>
  <p>Here is my code where I'm filtering results by that input:</p>
  <pre><code>&lt;input
  type=&quot;text&quot;
  placeholder=&quot;Cautare&quot;
  value={searchedLocation}
  onChange={(e) =&gt; { setSearchedLocation(e.target.value); }}
  /&gt;
  </code></pre>
  <pre><code>&lt;div className=&quot;workspace&quot;&gt;
     &lt;div className=&quot;locations-group&quot;&gt;
        {locations.filter((location) =&gt; {
           if (searchedLocation === null) {
              return location;
           } else {
              if(location.name.toLowerCase().includes(searchedLocation.toLowerCase()))
                 return location;
              }
           }).map((loc) =&gt; {
              return &lt;LocationModel locationName={loc.name} /&gt;
           } )}
     &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>