Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Warning: A future version of React will block javascript

I cloned repo from gitlab and installed the dependencies then When I type yarn next dev from command line I get

index.js:1 Warning: A future version of React will block javascript: URLs as a security precaution. Use event handlers instead if you can. If you need to generate unsafe HTML try using dangerouslySetInnerHTML instead. React was passed "javascript:;" 

error. And in the browser I get err code 404 on landing page. What is wrong I could not manage to get over.

like image 383
Serkan AKMAN Avatar asked Jan 21 '20 12:01

Serkan AKMAN


People also ask

What will replace ReactJS?

AngularJS is the best React JS alternative for building highly dynamic web, desktop, and mobile apps. It is an open-source JavaScript framework that helps you simplify and structure your JavaScript code. This technology allows you to create Single Page Applications (SPA) in a very convenient and clean way.

Can you use JavaScript and React together?

React is just JavaScript, there is a very small API to learn, just a few functions and how to use them. After that, your JavaScript skills are what make you a better React developer. There are no barriers to entry. A JavaScript developer can become a productive React developer in a few hours.

Is React still JavaScript?

React is still the best JavaScript framework to use for frontend web development in 2022, the framework features many out of the box tools that makes it a breeze to work with. React was created by Jordan Walke at Facebook in 2013. Since then react has grown to become the most used JavaScript framework right now.

Is React better than JavaScript?

ReactJS renders code from the server to the browser like a typical web page, unlike previous JavaScript frameworks. As a result, we can no longer talk about Google (or other browsers) having trouble reading your JavaScript-heavy web app. It is more effective.


1 Answers

It seems that somewhere in this code you have an element with an explicit javascript code somewhere in it's attributes. Something along the lines of

<a href="javascript:;" ...>...</a>

as the warning mentions: React was passed "javascript:;". This is probably some old repo, that was using this to get away with <a> tags that do not lead anywhere. The more common solution to this is usig href='#'.

However, the 404 you are getting is probably signifying something more and the repo itself is probably broken.

like image 149
Maciej B. Nowak Avatar answered Sep 19 '22 00:09

Maciej B. Nowak