0

i've been searching for a while now, so here i am trying to find a solution.

I've tried many ways to do it, [{attribute}], {attribute}..... cannot seem to find how to concat it.

const loremIpsum = (dolor) => {
      const attribute = "data-" + dolor;
      
      const domElement = <p [attribute]={dolor} > Result {dolor}</p>;
    
    return domElement;
    };
    
    //Called : loremIpsum("foo")
    //Expected result : <p data-foo="foo"> Result foo </p>

0 Answers0