Simple React Hello World Example

Simple React Hello World Example

Today, We want to share with you Simple React Hello World Example.In this post we will show you react js basics example tutorial, hear for react js examples for beginners we will give you demo and example for implement.In this post, we will learn about react js sample project step by step with an example.

Simple React Hello World Example

There are the Following The simple About Simple React Hello World Example Full Information With Example and source code.

As I will cover this Post with live Working example to develop understanding react js, so the install react and create react app Directory structures for this example is following below.

  ReactJS - Overview For Beginners step by step

React js sample project step by step

It simple displays a heading saying “Hello, world!” on the web page.

Syntex

ReactDOM.render(
  <h1>Hello, world!</h1>,
  document.getElementById('root')
);

Step 1: Run these commands:

npm i
npm start

We only have to simple run npm i the first time using CMD.

Step 2: package.json

{
  "name": "hello-react",
  "version": "1.0.0",
  "description": "pakainfo - Simple React Hello World",
  "main": "index.js",
  "scripts": {
    "start": "browserify -t babelify --outfile public/firstweb-app.js src/hello.jsx && echo 'Open http://localhost:8000/ in your browser' && (cd public ; python -m SimpleHTTPServer)",
    "watch": "watchify -v -t babelify --outfile public/firstweb-app.js src/hello.jsx"
  },
  "author": "",
  "license": "ISC",
  "repository": "none",
  "devDependencies": {
    "babelify": "^6.3.0",
    "browserify": "^11.2.0",
    "watchify": "^3.4.0"
  },
  "dependencies": {
    "react": "^0.14.3",
    "react-dom": "^0.14.3"
  }
}

Step 3: public_index.html

<!DOCTYPE html>
<html>
  <head>
    <title>Simple React Hello World - pakainfo.com</title>
  </head>
  <body>
    <h1>pakainfo.com - Simple React Hello World</h1>
    <div id="root"></div>
    <script src="/firstweb-app.js"></script>
  </body>
</html>

Step 4: src_hello.jsx

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

const Hello = function(name) {
  return (
    <div>Hello, {name}</div>
  );
};

const view = Hello("Will");

const element = document.getElementById("root");
ReactDOM.render(view, element);

Web Programming Tutorials Example with Demo

Read :

  ReactJS State Example Tutorial

Summary

You can also read about AngularJS, ASP.NET, VueJs, PHP.

I hope you get an idea about Simple React Hello World Example.
I would like to have feedback on my infinityknow.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.

Leave a Reply

avatar
  Subscribe  
Notify of