-
Notifications
You must be signed in to change notification settings - Fork 453
Expand file tree
/
Copy path01-HelloWorld.jsx
More file actions
36 lines (31 loc) · 1.28 KB
/
01-HelloWorld.jsx
File metadata and controls
36 lines (31 loc) · 1.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
var React = require("react");
// This is really simple React Component.
// It has its own name (HelloWorld) it will be used for things like error display.
//
// Task: Render HTML span with "Hello World" text.
class HelloWorld extends React.Component {
// All components *must* have a `render` method defined.
//
// To define a component's render method, we use syntax called JSX. As you
// can see it looks similar to HTML. You can use normal JavaScript too, but
// JSX is much more popular, so we will stick to it. JSX gets converted to
// JavaScript code. It is here just for readability purposes.
//
// Note: You can read about `render` syntax here:
// https://facebook.github.io/react/docs/displaying-data.html
//
// Warning! JSX is not HTML - in the following lessons you will notice the differences.
//
// React delivers a big set of standard HTML elements like `div`, `p`,
// `canvas` etc. Here you can see usage of a `div` element.
render() {
return (
<span>Hello World</span>
);
}
}
// Note:
// You can use the official Google Chrome extension to browse all ReactJS
// components rendered on a single page. See the description here:
// https://facebook.github.io/react/blog/2014/01/02/react-chrome-developer-tools.html
export default HelloWorld;