Keith M.
Keith M.

Reputation: 51

Why am I getting "Uncaught ReferenceError: React not defined"

I am getting Uncaught ReferenceError: React not defined, this is when I try to use the Chrome browser console to create var boldElement = React.createElement('b');. Why might this be happening?

Upvotes: 0

Views: 109

Answers (1)

Keith M.
Keith M.

Reputation: 51

The most basic reason that this might be happening could be how the file structure is created inside of your html. Check your syntax. It could be an issue where;

<head>
  <meta charset="utf-8">
  <title>Basic Example</title>
  <script src="/vendor/react.js"></script>
  <script src="/vendor/react-dom.js"></script>
</head>

However you need to place a period "." before your file path;

<head>
  <meta charset="utf-8">
  <title>Basic Example</title>
  <script src="./vendor/react.js"></script>
  <script src="./vendor/react-dom.js"></script>
</head>

Upvotes: 1

Related Questions