abcd Is there any way to do like this?" /> abcd Is there any way to do like this?" /> abcd Is there any way to do like this?"/>

Can a fragment have an attribute?

807 Views Asked by At

I have to set an attribute to the fragment. I want to do something like this:

<className="name">
  abcd
</>

Is there any way to do like this?

1

There are 1 best solutions below

0
Lafi On BEST ANSWER

You can't since it's React specific and not an HTML tag. Here is what the docs say:

You can use <></> the same way you’d use any other element except that it doesn’t support keys or attributes.