Hello World in React

The first step to getting familiar with a new language is to write a simple “Hello World” program. React JS is an open-source JavaScript library for building user interfaces (usually for single-page applications).

svg viewer

Code

In the code below, you need to import React by using this command:

import React from `react`

Then, import ReactDOM for the render() function in which the HTML code is specified.

A style sheet can be used for the specified HTML code as well.

import React from 'react';
require('./style.css');

import ReactDOM from 'react-dom';


ReactDOM.render(
  <p>HelloWorld!</p>,
  document.getElementById('root')
);

Free Resources

Copyright ©2025 Educative, Inc. All rights reserved