black_yurizan
black_yurizan

Reputation: 437

Trying to understand warning messages I get when using babel for react.js

I have made a simple react rendering function that prints out hello in a div tag with the id of "react-container". The only problem is that I keep getting warning messages in the console like

unreachable code after return statement

or

mutating the [[Prototype]] of an object will cause your code to run very slowly; instead create the object with the correct initial [[Prototype]] value using Object.create

All of this is coming from the babel-core browser.js script I inserted into the document. I'm trying to figure out what it means, am I doing something wrong, or should I just ignore it

    <!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title>REACT 1</title>
    <script src="react-15.2.1.js"></script>
<script src="react-dom-15.2.1.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/babel-core/5.8.24/browser.js"></script>
  </head>
  <body>
    <div id="react-container">

    </div>
<script type="text/babel" >

 ReactDOM.render(<h1>hello</h1>, document.getElementById('react-container'));
</script>
  </body>
</html>

Upvotes: 0

Views: 424

Answers (1)

Andy Ray
Andy Ray

Reputation: 32076

This is the default behavior of the Firefox developer console. More advanced debugging environments like the Chrome console don't show warnings like these. You can disable the linting of scripts in Firefox by clicking on this button:

enter image description here

A "warning" is simply that: A warning that there might be a potential issue with the syntax of code. In this case the warnings are harmless, and because they come from third party scripts, there's not much you can do about it. Especially the second one, which is really more of an opinionated code style.

Upvotes: 2

Related Questions