EN
React - Using target="_blank" without rel="noreferrer" warning
1 answers
0 points
Hello, today I've been coding some React components, and I ran into the warning below. How can make it stop showing me this warning?
Warning:
xxxxxxxxxx
1
Line 16:7: Using target="_blank" without rel="noreferrer" (which implies rel="noopener") is a security risk in older browsers: see https://mathiasbynens.github.io/rel-noopener/#recommendations react/jsx-no-target-blank
My code:
xxxxxxxxxx
1
const MyFooter = () => {
2
return (
3
<div className="MyFooter">
4
<a href="https://www.youtube.com/channel/UCXyQaRr4I7wIwtRSrFdyDnA" target="_blank"></a>
5
</div>
6
);
7
};
8
9
export default MyFooter;
1 answer
0 points
You have to add rel="noreferrer"
to the <a>
element to fix it.
Your code should look like:
xxxxxxxxxx
1
const MyFooter = () => {
2
return (
3
<div className="MyFooter">
4
<a href="https://www.youtube.com/channel/UCXyQaRr4I7wIwtRSrFdyDnA" target="_blank" rel="noreferrer"></a>
5
</div>
6
);
7
};
8
9
export default MyFooter;
For more information go to the following article:
0 commentsShow commentsAdd comment