# Displaying data The most basic thing you can do with a UI is display some data. React makes it easy to display data, and automatically keeps it up-to-date when the data changes. ## Getting started Let's look at a really simple example. Create a `hello-react.html` file with the following code: ```html Hello React
``` For the rest of the documentation, we'll just focus on the JavaScript code and assume it's inserted into a template like the one above. Replace the placeholder comment above with the following JS: ```javascript /** @jsx React.DOM */ var HelloWorld = React.createClass({ render: function() { return (

Hello, ! It is {this.props.date.toTimeString()}

); } }); setInterval(function() { React.renderComponent( , document.getElementById('example') ); }, 500); ``` ## Reactive updates View the finished code in a web browser and type your name into the text field. Notice that React is only changing the time string in the UI -- any input you put in the text field remains, even though you haven't written any code to manage this behavior. React figures it out for you and does the right thing. ## JSX syntax We strongly believe that components are the right way to separate concerns rather than "templates" and "display logic." We think that markup and the code that generates it are intimately tied together. Additionally, display logic is often very complex and using template languages to express it becomes cumbersome. We've found that the best solution for this problem is to generate markup directly from the JavaScript code such that you can use all of the expressive power of a real programming language to build UIs. In order to make this easier, we've added a *very* simple, **optional** HTML-like syntax for the function calls that generate markup called JSX. ### Don't use JSX if you don't like it! React works out of the box without JSX. Simply construct your markup using the functions on `React.DOM`. For example, here's how to construct a simple link: ```javascript var link = React.DOM.a({href: 'http://facebook.github.io/react'}, 'React'); ``` However, we recommend using JSX for many reasons: - It's easier to visualize the structure of the DOM. - Designers are more comfortable making changes. - It's familiar for those who have used MXML or XAML. ### The Transform JSX transforms XML-like syntax into native JavaScript. It turns XML elements and attributes into function calls and objects, respectively. ```javascript var Nav; // Input (JSX): var app =