Skip to main content

Hello React !

React is a UI library developed at Facebook to facilitate the creation of interactive, stateful & reusable UI components.

This article will help you create your first 'Hello World' webpage with React without knowledge of Node / npm.

Steps to create Hello World page
1) Create new .txt file and save as .html on your computer.

2) Add react.js, react-dom.js and browser.min.js links from CDN library to HTML header.

3) Add div tag with id="content" in body as a parent container to display custom text.

4) Add script type="text/babel" tag and start writing react code inside it. 
type="text/babel" helps browser to render JSX inside script. JSX is a Javascript XML syntax transform. This lets you write HTML-ish tags in your Javascript.

 5) Use ReactDOM's Render method. Our first argument is the component we want to render (i.e. h1), and the second is the DOM node it should mount to (i.e. div id="content").

6) We are ready. Open your HTML file in latest browser.

Example 1:

Ideal way is to create custom component classes with createClass method and render this component in your document.  Lets create one below :

Example 2:


Both examples will produce same results, only we are using custom component in second example.

Hope you find this article helpful.

Comments

Popular posts from this blog

Sikkim Darjeeling Tour

Visited Sikkim and Darjeeling on 13-Jun-2015 to 20-Jun-2015 with my wife. Here is trip information which you might find helpful to plan your North East trip  Day 1 -  1) Mumbai to Bagdogra flight ( Rs 8000 per person) 2) Bagdogra to Kalimpong (Prepaid cab Rs 1400, 3 hours) 3) Kalimpong siteseeing (takes 2 - 3 hours)     1. Cactus Nurseries     2. Durbin Dara Monastery     3. Mangal Dham     4. Deolo Hill 4) Kalimpong to Gangtok (2.5 hours)     Full day taxi 4200     Overnight stay at Gangtok Day 2 - 1) Gangtok 10 point siteseeing (local taxi Rs 1600. 5 hours)     1. Bakhtang waterfall     2. Gunjung Monetrary     3. Tashi view point     4. Lasa waterfall     5. Plant Consertaion     6. Ganesh Tok     7. Flower show (must visit)     8. Ropeway     9. Institute of Tibetology (Closed on Sunday...

eFiling of I.T. Returns AY 2016-17

e-Filing of income tax is quite simplified process. This blog will help you to file own IT returns online with ITR-1 form. ITR-1 form is applicable if you have income from following sources: Salary House rent / loan Interest on saving bank account / FD Agriculture income less than Rs 5000 Prerequisites for e-filing Form 16 Form 26AS (refer Step 4 below) Interest from saving bank account / FD Any investment that is not declared with company or not reflected in Form 16 Follow below steps to e-file your IT Returns (click on pictures to enlarge) Step 1 – Get Form 16 from your employer Step 2  – Register yourself at site  http://incometaxindiaefiling.gov.in/ Step 3  – Login on site User ID is your PAN Step 4  – Download From 26AS Follow link View Form 26AS (Tax Credit), you will be redirected to TRACES site. Download form 26AS for current Assessment year. Step 5  –  Quick e-File ITR-1 Click Q...

eFiling of IT Returns AY 2018-19

e-Filing of income tax is quite simplified process. This blog will help you to file own IT returns online with ITR-1 form for Assessment Year 2018-19 (Financial Year 2017-18). Last Date: 31st August 2018. This year penalty of Rs 1000 to Rs 5000 has been introduced for filing returns after the due date but before 31st Dec 2018 and Rs 10000 post 31st Dec 2018. ITR-1 form is applicable if you have income from following sources: Salary House rent / loan Interest on saving bank account / FD Agriculture income less than Rs 5000 Shares dividend + Other non taxable income Prerequisites for e-filing Form 16 Form 26AS (refer Step 4 below) Interest from saving bank account / FD Any investment that is not declared with company or not reflected in Form 16 Follow below steps to e-file your IT Returns  (click on pictures to enlarge) Step 1  – Get Form 16 from your employer Step 2  – Register yourself at site  https://www.incometaxindiaefiling.g...