score:0

  render() {
  const therel = "nofollow";
  return (
    <div>
      <a href="/users/users/authentication" rel={therel}/>
    </div>
  );
}

score:0

you can set rel like this:

render() {
  const rel = "nofollow";
  return (
    <div>
      <a href="/users/users/authentication" rel={rel}>hey</a>
    </div>
  );
}

score:5

you'd first have to decide what "shape" of your rel value should be. would it be a text? or would it be an object?

1 rel is a text.

if the rel is passed as a raw text, such as nofollow, you'd have to assign the rel property manually.

function linkwithpropertyassignment() {
  const rel = "nofollow";

  return (
    <a href="https://www.google.com" rel={rel}>
      google
    </a>
  );
}

2 rel is an object.

if the rel was passed as an object, such as {rel: 'nofollow'}, then you can simply pass the object to the anchor element.

function linkwithobjectspread() {
  const rel = { rel: "nofollow" };

  return (
    <a href="https://www.bing.com" {...rel}>
      bing
    </a>
  );
}

you can see that both will add rel='nofollow' attribute.

rendered html

demo

you can follow along on codesandbox.
edit so.answer.56133987


Related Query

More Query from same tag