Are you first timer at lazacode.org? Why not join us and start exchange your programming knowledge with everyone. Register today!

React - conditional rendering in backtick

0 votes
14 views
added Apr 27 in React by lcjr Second Warrant Officer (5,360 points)
let carurlObj = { pathname: '/car-detail', query };
let carUrl = `/car/${carItemData.url_s}`;

if (isNewCar) {
  carurlObj = { pathname: '/new-car-detail', query };
  carUrl = `/new-launches/${carItemData.url_s}`;
}
if (isImportedCar) {
  carurlObj = `https://example.com/imported-car-detail/${carItemData.url_s}`;
  carUrl = `https://example.com/imported-car-detail/${carItemData.url_s}`;
}

 

Please log in or register to response this reference.

lazacode.org - Malaysia's programming knowledge sharing platform, where everyone can share their finding as reference to others.
...