DEV Community

Discussion on: Introduction to DML - part 2: using functional templating

Collapse
 
artydev profile image
artydev

Hy Eckehard,

Is the a reason you don't use template strings lke this : ?

// round button
    function RB(s, color = "yellow") {
      const r = 30;
      //return button(s, "width:" + px(r) + "; height:" + px(r) + "; border-radius: 50%; background-color: " + color + ";  margin: 3px;")
      return button(s,  {style: `width:px(${r});height:px(${r});border-radius: 50%; background-color:${color};margin: 3px;`})
    }
  RB("2", "red")
Enter fullscreen mode Exit fullscreen mode

Regards

Collapse
 
efpage profile image
Eckehard

I just dont like the mixed syntax, but there is nothing wrong with. I assume it should be width:${r}px;...

Collapse
 
artydev profile image
artydev • Edited

Ok
I am not fan of '+' for concatenate strings :-)
I understand your view, although I don't like '$' in strings, I like the fact I can make multilines easier