logoESLint React
Rules

jsx-no-undef

Full Name in eslint-plugin-react-x

react-x/jsx-no-undef

Full Name in @eslint-react/eslint-plugin

@eslint-react/jsx-no-undef

Description

Prevents using variables in JSX that are not defined in the scope.

Examples

Failing

import React from "react";
 
const button = <MyButton />;
//              ^^^^^^^^
//              - 'MyButton' is not defined

Passing

import React from "react";
import MyButton from "./MyButton";
 
const button = <MyButton />;

Implementation


See Also

On this page