[React MAIN CONCEPTS] 2. 1. Hello World

1. Hello World

The smallest React example looks like this:

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

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

Try it on CodePen - https://reactjs.org/redirect-to-codepen/hello-world

React is a JavaScript library, and so we’ll assume you have a basic understanding of the JavaScript language. If you don’t feel very confident, we recommend going through a JavaScript tutorial - https://developer.mozilla.org/en-US/docs/Web/JavaScript/A_re-introduction_to_JavaScript to check your knowledge level and enable you to follow along this guide without getting lost. It might take you between 30 minutes and an hour, but as a result you won’t have to feel like you’re learning both React and JavaScript at the same time.

References

[1] Hello World – React - https://reactjs.org/docs/hello-world.html

[2] A re-introduction to JavaScript (JS tutorial) - JavaScript | MDN - https://developer.mozilla.org/en-US/docs/Web/JavaScript/A_re-introduction_to_JavaScript