Skip to content

react/react-in-jsx-scope Suspicious ​

What it does ​

Disallow missing React when using JSX

Why is this bad? ​

When using JSX, <a /> expands to React.createElement("a"). Therefore the React variable must be in scope.

Example ​

Examples of incorrect code for this rule:

jsx
var a = <a />;

Examples of correct code for this rule:

jsx
import React from "react";
var a = <a />;

References ​

Released under the MIT License.