Skip to content

Files

Latest commit

 

History

History
20 lines (14 loc) · 386 Bytes

react-in-jsx-scope.md

File metadata and controls

20 lines (14 loc) · 386 Bytes

Pattern: Missing React import with JSX usage

Issue: -

Description

JSX syntax transpiles to React.createElement() calls, requiring the React variable to be in scope. Without importing React, JSX code will fail at runtime.

Examples

Example of incorrect code:

var a = <a />;

Example of correct code:

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