Explore Bato Web Agency Webflow Certified Partner Profile Explore Bato Web Agency Webflow Certified Partner Profile

ReferenceError: React is not defined — why is JSX failing?

Illustration without a description Illustration without a description

The generated component refers to React without a binding in that scope. The classic JSX transform can emit React.createElement calls from JSX, so the source may look as if it never uses the name. Inspect what your compiler produced for the file named in the error.

 

For the classic transform, import React in the file that uses JSX. If the project uses the automatic transform, check that the compiler and installed runtime agree and that this file goes through the same pipeline. A mixed configuration can show up in one package or entry point.

 

React.createElement in the generated file identifies the name the classic transform needs in scope. After fixing the configuration, confirm the deployed output contains the intended generated code and that the page is not serving raw JSX.

 

// For the classic JSX runtime, ensure React is imported. import React from 'react'; export default function Badge() { return React.createElement('span', null, 'Ready'); }

 

Open the generated component and see whether it calls React.createElement or imports the automatic JSX runtime.