How to write || in heex

here it is the leex version code

<article class="column"> 
  <img
  alt="product image" width="200" height="200" 
  src="<%=Routes.static_path(
  @socket,
  @product.image_upload || "/images/default-thumbnail.jpg")%>">
</article>

Now, how to convert it into heex ?

<article class="column">
  <img
    alt="product image" width="200" height="200"
    src="{Routes.static_path(
      @socket,
      @product.image_upload || "/images/default-thumbnail.jpg")}">
</article>

Thansks

1 Like

Have you tried what is written here? If so, did you get an error?

1 Like

have fixed it as the following

<article class="column">
  <img
    alt="product image" width="200" height="200"
    src="{Routes.static_path(
      @socket,
      @product.image_upload || ~s[/images/default-thumbnail.jpg] )}">
</article>

You should remove ", heex syntax is like this…

<img
  attr1={value}
  # or
  attr2={"#{var} text"}
/>
1 Like