JavaScript

JavaScript

By DeepSource

React must be present in scope when using JSX JS-0464

Bug risk

The React object contains many objects that are referenced indirectly when expanding JSX.

When using JSX, <a /> expands to React.createElement("a"). Therefore React must be imported.

Bad Practice

const Hello = <div>Hello {this.props.name}</div>;

Recommended

import React from 'react';
const Hello = <div>Hello {this.props.name}</div>;