DocumentationRulesprefer-react-namespace-import

prefer-react-namespace-import

🔧 This rule is automatically fixable by the --fix CLI option.

Rule category

Style.

What it does

Enforce React is imported via a namespace import.

Examples

Failing

import React from "react";
 
import type React from "react";
 
import React, { useState } from "react";
 
import type React, { useState } from "react";

Passing

import * as React from "react";
 
import type * as React from "react";
 
import { useState } from "react";
 
import type { useState } from "react";