logo

Hello World in React

A simple 'Hello World' component in React.

5 Stars

Code

import React from 'react';

const HelloWorld = () => {
  return (
    <div>
      <h1>Hello, World!</h1>
    </div>
  );
};

export default HelloWorld;

Explanation

This code defines a functional React component called HelloWorld. It returns a JSX element containing a div with an h1 element that displays 'Hello, World!'.