Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

338
Views
Why I am getting the error: Uncaught Error: HomePage(...): Nothing was returned from render. This usually means a return statement is missing

Node version: 17.3.0

NPM version: 8.3.0

I am learning react js. While practicing a project I am getting this error. Error:

Uncaught Error: HomePage(...): Nothing was returned from render. This usually means a return statement is missing. Or, to render nothing, return null.

My code are given below:

index.js

import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
import App from './App';
import reportWebVitals from './reportWebVitals';

ReactDOM.render(
  <React.StrictMode>
    <App />
  </React.StrictMode>,
  document.getElementById('root')
);

// If you want to start measuring performance in your app, pass a function
// to log results (for example: reportWebVitals(console.log))
reportWebVitals();

app.js

import './App.css';
import HomePage from './homepage';

function App() {
  return (
    <div className="App">
      <HomePage />
    </div>
  );
}

export default App;

homepage.jsx

import React from 'react';

const HomePage = () => {
  <div className="homepage">
    <div className="directory-menu">
      <div className="menu-item">
        <div className="content">
          <h1 className="title">HATS</h1>
          <span className="subtitle">SHOP NOW</span>
        </div>
      </div>
    </div>
  </div>;
};

export default HomePage;

Full image of error

enter image description here

How to solve this error? Please help me to solve this problem.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

You are not returning anything from the function.

const HomePage = () => {
  return <div className="homepage">
    <div className="directory-menu">
      <div className="menu-item">
        <div className="content">
          <h1 className="title">HATS</h1>
          <span className="subtitle">SHOP NOW</span>
        </div>
      </div>
    </div>
  </div>;
};

or

const HomePage = () => (
  <div className="homepage">
    <div className="directory-menu">
      <div className="menu-item">
        <div className="content">
          <h1 className="title">HATS</h1>
          <span className="subtitle">SHOP NOW</span>
        </div>
      </div>
    </div>
  </div>;
);

would be correct way

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!