title: How to filter out null object in react.js
body: <p>in the code below i tried to filter out the null objects from the list was collecting from an API.
  but i was unable because of the null brand name. Thank you from Zambia.</p>
  <pre><code> {brandsQuery.isLoading ? (
      &lt;span&gt;Loading...&lt;/span&gt;
      ) : brandsQuery.isError ? (
      brandsQuery.error.message
      ) : (
      brandsQuery.data.filter(brand =&gt; brand.brand != ' ').map((filteredBrand) =&gt; (
          &lt;div key={filteredBrand.brand} className=&quot;form-check&quot;&gt;
              &lt;label htmlFor={filteredBrand.brand} className=&quot;form-check-label&quot;&gt;
                  &lt;input
                      className=&quot;form-check-label&quot;
                      type=&quot;checkbox&quot; 
                      value={filteredBrand.brand}
                      id={filteredBrand.brand} /&gt;
                  {filteredBrand.brand}
                  {console.log('start')}
                  {console.log(filteredBrand)}
                  {console.log('end')}
              &lt;/label&gt;
          &lt;/div&gt;
      ))
  )}
  </code></pre>