Basic React JS App – Sample Code

React is one of the most popular front-end JS framework. Here is a sample react app code for beginners.

index.js

import React from "react";
import ReactDOM from "react-dom";

ReactDOM.render(
  <div>
    <h1> My List</h1>
    <ul>
      <li> Apple</li>
      <li> Banana</li>
      <li> Mango</li>
    </ul>
  </div>
  ,document.getElementById("root")
);

index.html

<!DOCTYPE html>
<html lang="en">
  <head>
    <title>JSX</title>
    <link rel="stylesheet" href="styles.css" />
  </head>

  <body>
    <div id="root"></div>
    <script src="../src/index.js" type="text/javascript"></script>
  </body>
</html>

About the Author: smartcoder

You might like

Leave a Reply

Your email address will not be published. Required fields are marked *