Basic Introduction to React.js

The aim of this article is to make a basic introduction to react.js.
Today React.js is gaining much more popularity in Front-end Web Developer world.

As we understand, React.js is a front-end developement framework, created and maintained by facebook for their production application. The framework focuses on UI and expect to handle the backend by WEB Apis. React.js implements One way data-flow.

We are learning React.js and will try to go through all the concepts of React.js step-by-step.

Here is a first Example of React.js Code, which will simply print “Hello React World” on the Html Page.


Basic Example without JSX


<!DOCTYPE html>
<meta http-equiv=’Content-type’ content=’text/html; charset=utf-8′>
<title>Basic Example</title>
<script src="react.js"></script>

<h1>Basic Example</h1>
<div id="container">

<script src="react.js"></script>
var ExampleApplication = React.createClass({
render :function()
var message = "Hello React World";
return React.DOM.b(null, message);



We assume here, react.js is in our application root folder. No other dependencies are there in this code.
What – the code is doing? It simply prints some text in the web page.

React uses a specialized version of javascript, which is called jsx. These jsx codes are needed to be complied to produce pure javascript. To simplify this conversion, JSXTransformer.js is needed to be included in the Application web page. But for now, we have not used this feature and simply made a javascript code to show the example with react.js. We will see the use of JSXTransformer.js in our next articles.

In the above code, the ExampleApplication is represented as a React Class, which is having a pre-defined render method. This render method is responsible to update the view of the React Component. Here it is attaching a “hello world” king of message to the React DOM.

Now with the React.renderComponent, it is taking the class ExampleApplication and the respective div container – where the react component will be rendered. So finally it is showing the Hello React World.

We will write step-by-step article to understand react.js features. Meanwhile, for better understanding react.js, we should refer to facebook tutorial.

If you find this article helpful, you can connect us in Google+ and Twitter.

Leave a Reply

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