Skip to content Skip to sidebar Skip to footer

Console Error While Running React Js Sample Web App

I am new to React js and was trying my hands on a very simple hello react kinda web app. But while running, ended up at below error in console. Calling Element.createShadowRoot() f

Solution 1:

First of all, the cdns you are using for the library files are unreachable.

Unreachable CDNs

From the React Docs page these are the working links for the cdn:

https://npmcdn.com/react@15.3.1/dist/react.min.js

https://npmcdn.com/react-dom@15.3.1/dist/react-dom.min.js

https://npmcdn.com/babel-core@5.8.38/browser.min.js

Second, there should be comma after <h1>Hello React!</h1> that separates what should be rendered to where .

So your code should look like this:

<!DOCTYPE html><html><head><metacharset="UTF-8"/><scriptsrc="https://npmcdn.com/babel-core@5.8.38/browser.min.js"></script><scriptsrc="https://npmcdn.com/react@15.3.1/dist/react.min.js"></script><scriptsrc="https://npmcdn.com/react-dom@15.3.1/dist/react-dom.min.js"></script></head><body><divid="app"></div><scripttype="text/babel">ReactDOM.render(
                <h1>Hello React!</h1>,
                document.getElementById('app')
            );
        </script></body></html>

Solution 2:

You links are broken. Use these updated links

Use domain cdnjs.cloudflare.com instead of cdnjs.cloudfare.com

https://cdnjs.cloudflare.com/ajax/libs/babel-core/5.8.23/browser.js
https://cdnjs.cloudflare.com/ajax/libs/react/0.14.7/react.js
https://cdnjs.cloudflare.com/ajax/libs/react/0.14.7/react-dom.js

Post a Comment for "Console Error While Running React Js Sample Web App"