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.
demo
Source: stackoverflow.com
Related Query
- Insert React variable as attribute in html tag
- Insert React env variable into HTML script tag
- Insert HTML with React Variable Statements (JSX)
- accessing variable from script tag in html file in react component
- React styled-component not recognising HTML attribute 'autoplay' of video tag
- Insert React component into a String variable with html content
- html tag attribute "data-setbg" is not working in React project
- React Components to SvelteKit - Objects with HTML in attribute (JSX rendering) to Script tag
- Insert custom React component into a String variable with html content
- how to display variable value in HTML tag in react
- How do you reference a process.env variable in HTML <script src="" ? React
- Insert HTML comments in React
- Can I pass HTML tag as prop - React
- JSX with a HTML tag from a variable
- How do I insert a Django template variable into a React script?
- Custom HTML Element Tag within React JSX
- Pass React component to HTML attribute
- In React, what is the function of the key attribute in html tag
- Get HTML tag name from React element?
- how to to insert TradingView widget into react js which is in script tag link: https://www.tradingview.com/widget/market-overview/
- Store multiple html elements in variable with React
- How to insert HTML tag with injectIntl formatMessage using React-Intl?
- Download attribute in anchor tag in React component
- React JSX - dynamic html attribute
- Insert HTML into user string and render it in React (and avoid XSS threat)
- How to add lang attribute to html tag in Next.js?
- React - Converting HTML script tag to load an SDK asynchronously
- React JS edit image overlay on img html tag
- Create React App 2 - remove html attribute for testing
- Inserting html inside string variable used in React component
More Query from same tag
- Basic issue with ReactJS setting state in functional component
- Rerender React child component with a complex/nested state update
- Access Dispatch inside of Function
- reactjs universal-cookie package error when calling get()
- React exporting withRouter and withStyles error
- Separate config for DEV and PROD of wepack5 not working
- Trying to pass a value to the handler but received as undefined
- Error creating react app in termux on android phone
- Hover effect on IconButton in Material-UI
- How to pass an array in query parameter reactjs
- How to set X coordinate for each bar with react chart js 2?
- readFragment causing IntrospectionFragmentMatcher error although not using interface or unions
- How to add child array input field dynamically in React JS
- How do I add some state to redux state when try to write unit test in jest/RTL?
- Shopify Polaris Page tag not working - Rails and reactJS
- Getting errors with Google Maps API, using recompose and react-google-maps
- React Router Link Not Rendering the Component but changes the URL
- SetInterval on mount for a set duration
- ReactJs - Cannot open popup in modal window
- ChartJS - Why is the transition on the first dataset bad?
- React material UI autocomplete is not working with the formik
- toggle class on multiple elements react
- Rendering a react component variable with react router v6
- Refresh on protected Routes React Router with firebase auth
- I am trying to delete some data from firestore but there is a problem (react)
- Generically typed (yet specific to Event) custom useEvent hook in react typescript
- useEffect and ESlint exhaustive-deps rule
- Tracker.autorun not working inside componentDidMount of react
- MongooseError [OverwriteModelError]: Cannot overwrite `Team` model once compiled
- Displaying Home header on other Tab screens after adding authentication.(Following React Navigation Docs)