Skip to content

Commit db7ff55

Browse files
committed
Add javascript urls question
1 parent 179c1ce commit db7ff55

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -334,6 +334,7 @@
334334
|318| [Should I learn ES6 before learning ReactJS?](#should-i-learn-es6-before-learning-reactjs)|
335335
|319| [What is Concurrent Rendering?](#what-is-concurrent-rendering)|
336336
|320| [What is the difference between async mode and concurrent mode?](#what-is-the-difference-between-async-mode-and-concurrent-mode)|
337+
|321| [Can I use javascript urls in react16.9?](#can-i-use-javascript-urls-in-react16.9)|
337338

338339
## Core React
339340

@@ -5251,3 +5252,13 @@
52515252
```
52525253
320. ### What is the difference between async mode and concurrent mode?
52535254
Both refers the same thing. Previously concurrent Mode being referred to as "Async Mode" by React team. The name has been changed to highlight React’s ability to perform work on different priority levels. So it avoids the confusion from other approaches to Async Rendering.
5255+
321. ### Can I use javascript urls in react16.9?
5256+
Yes, you can use javascript: URLs but it will log a warning in the console. Because URLs starting with javascript: are dangerous by including unsanitized output in a tag like <a href> and create a security hole.
5257+
```javascript
5258+
const companyProfile = {
5259+
website: "javascript: alert('Your website is hacked')",
5260+
};
5261+
// It will log a warning
5262+
<a href={companyProfile.website}>More details</a>
5263+
```
5264+
Remember that the future versions will throw an error for javascript URLs.

0 commit comments

Comments
 (0)