I want the searchbox to disappear from all pages except product page with React.js

When i do this ternay operator the result is that the searchbox desappear from every page. The idea is only to show in /products. Thank you if you could help me with this, very much appreciated.


function Header() {
let location = useLocation();


{location === "/products" ? (
                      <li>
                        <form action="#" class="form-box f-right">
                          <input
                            type="text"
                            name="Search"
                            placeholder="Search products"
                          />
                          <div class="search-icon">
                            <i class="ti-search"></i>
                          </div>
                        </form>
                      </li>
                    ) : null}```


from Recent Questions - Stack Overflow https://ift.tt/3wMkdgK
https://ift.tt/eA8V8J

Comments

Popular posts from this blog

Today Walkin 14th-Sept

Spring Elasticsearch Operations

Hibernate Search - Elasticsearch with JSON manipulation