1

HTML

<div id="p1"> </div>

JS (Babel)

function MyFunct () {
  return (
    <div>
      <h1>Tanzeel</h1>
      <p>Hello World</p>
    </div>
  );
}
ReactDOM.render(< MyFunct />, document.querySelector('#p1'));

I've also included both the CDNs.

1) React
https://cdnjs.cloudflare.com/ajax/libs/react/16.4.2/umd/react.production.min.js


2) ReactDOM
https://cdnjs.cloudflare.com/ajax/libs/react-dom/16.5.1/umd/react-dom.production.min.js

3) JavaScript Preprocessor
Babel

4) Code Pen
Click here

2
  • ReactDOM cdn library not loaded successfully. If you look at console then it throws error Uncaught ReferenceError: ReactDOM is not defined. Commented Oct 4, 2018 at 6:16
  • use these cdn links instead: reactjs.org/docs/cdn-links.html Commented Oct 4, 2018 at 6:28

1 Answer 1

0

Use the 16.4.2 version of ReactDOM instead so it matches your React version, I had same issue so not your fault:

https://cdnjs.cloudflare.com/ajax/libs/react-dom/16.4.2/umd/react-dom.production.min.js

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.