Skip to content

Files

Latest commit

 

History

History
20 lines (14 loc) · 435 Bytes

jsx-no-undef.md

File metadata and controls

20 lines (14 loc) · 435 Bytes

Pattern: Undeclared variable in JSX

Issue: -

Description

Using undefined variables in JSX likely indicates a misspelling or a missing import, which will cause a ReferenceError at runtime. All components used in JSX must be declared or imported before use.

Examples

Example of incorrect code:

const C = <B />; // B is not defined

Example of correct code:

import B from './B';
const C = <B />;