Skip to content

How to Fix React Component Not Rendering

DodaTech Updated 2026-06-24 3 min read

In this tutorial, you'll learn about How to Fix React Component Not Rendering. We cover key concepts, practical examples, and best practices.

The Problem

A React component does not appear on the screen despite being included in the JSX, typically due to a missing return statement, incorrect import, or a conditional that evaluates to false.

Quick Fix

Step 1: Check the return statement

A component without an explicit return renders nothing:

function UserProfile({ user }) {
    <div>
        <h1>{user.name}</h1>
    </div>
}

Add return:

function UserProfile({ user }) {
    return (
        <div>
            <h1>{user.name}</h1>
        </div>
    );
}

Step 2: Verify the import path

A component with a wrong import silently renders nothing:

import UserProfile from './components/UserProfile';

function App() {
    return <UserProfile />;
}

If the file exports as default, check the filename matches:

import UserProfile from './components/UserProfile';

Step 3: Check conditional rendering

A false condition prevents rendering:

function Dashboard({ isAdmin }) {
    return (
        <div>
            <h1>Dashboard</h1>
            {isAdmin && <AdminPanel />}
        </div>
    );
}

If isAdmin is false, AdminPanel does not render. Log it:

function Dashboard({ isAdmin }) {
    console.log('isAdmin:', isAdmin);
    return (
        <div>
            <h1>Dashboard</h1>
            {isAdmin && <AdminPanel />}
        </div>
    );
}

Step 4: Check for naming collisions

A lowercase component name is treated as an HTML tag:

function userProfile() {
    return <div>Profile</div>;
}

function App() {
    return <userProfile />;
}

React renders an HTML <userprofile> element, not the component. Capitalize:

function UserProfile() {
    return <div>Profile</div>;
}

function App() {
    return <UserProfile />;
}

Step 5: Check for empty fragments

A component returning an array must have keys:

function Items() {
    return [
        <li>One</li>,
        <li>Two</li>
    ];
}

Wrap in a fragment:

function Items() {
    return (
        <>
            <li>One</li>
            <li>Two</li>
        </>
    );
}

Prevention

  • Use ESLint react-hooks/rules-of-hooks and react/jsx-no-undef.
  • Capitalize all component names.
  • Always include an explicit return in component bodies.
  • Use TypeScript to catch missing imports and incorrect prop types.
  • Add console.log inside the component to verify it renders.

Common Mistakes with component not rendering

  1. Using foldl instead of foldl' causing stack overflow on large lists
  2. Forgetting deriving (Show, Eq) on custom data types needed for debugging
  3. Placing the wildcard pattern first in case expressions, making all subsequent patterns unreachable

These mistakes appear frequently in real-world REACT code. DodaTech's contributors have identified these patterns through analysis of open-source projects and production systems.

Practice Exercise

Write a pure function that safely divides two integers using Maybe, then test it with edge cases like division by zero and negative numbers.

This exercise reinforces the concepts covered in this guide. Try implementing it before checking online solutions.

FAQ

### Why does my component render but show nothing?

The component may be rendering an empty wrapper, a falsy value, or null. Check the JSX output by temporarily rendering a simple string: return <div>TEST</div>. If that appears, the issue is in the dynamic content, not the component structure.

Why does my component render twice in development?

React StrictMode intentionally double-invokes components in development to detect side effects. This only happens in development mode and does not affect production builds. If you see double renders, it is normal behavior from <React.StrictMode>.

Can a component render but not update?

Yes, if the component is not properly memoized or if props/state references do not change. Check that you are using useState for mutable data and that you are not mutating state directly. Use React.memo for pure components and verify that prop references update correctly.

Built by the developers of DodaTech

Doda Browser, DodaZIP & Durga Antivirus Pro