{"id":29066,"date":"2017-01-30T23:01:53","date_gmt":"2017-01-30T15:01:53","guid":{"rendered":"https:\/\/www.hongkiat.com\/blog\/?p=29066"},"modified":"2025-04-04T02:49:33","modified_gmt":"2025-04-03T18:49:33","slug":"getting-started-react-js","status":"publish","type":"post","link":"https:\/\/www.hongkiat.com\/blog\/getting-started-react-js\/","title":{"rendered":"Getting Started with React.js"},"content":{"rendered":"<p><strong><a rel=\"nofollow noopener\" target=\"_blank\" href=\"https:\/\/reactjs.org\/\">React.js<\/a><\/strong> is a <strong>flexible and component-based<\/strong> <a target=\"_blank\" href=\"https:\/\/www.hongkiat.com\/blog\/javascript-libraries-for-interactive-maps\/\" rel=\"noopener\">JavaScript library<\/a> for <strong>building interactive user interfaces<\/strong>. It was <strong>created and open-sourced by Facebook<\/strong> and is used by many leading tech companies such as Dropbox, AirBnB, PayPal, and Netflix. React allows developers to <strong>create data-heavy apps<\/strong> that can be painlessly updated by <strong>re-rendering only the necessary components<\/strong>.<\/p>\n<div class=\"ref-block ref-block--post\" id=\"ref-post-1\">\n\t\t\t\t\t<a href=\"https:\/\/www.hongkiat.com\/blog\/choosing-right-javascript-mvc-framework\/\" class=\"ref-block__link\" title=\"Read More: Choosing the Right JavaScript MVC Framework [Infographic]\" rel=\"bookmark\"><span class=\"screen-reader-text\">Choosing the Right JavaScript MVC Framework [Infographic]<\/span><\/a>\n<div class=\"ref-block__thumbnail img-thumb img-thumb--jumbo\" data-img='{ \"src\" : \"https:\/\/assets.hongkiat.com\/uploads\/thumbs\/250x160\/choosing-right-javascript-mvc-framework.jpg\" }'>\n\t\t\t\t\t\t\t<noscript>\n<style>.no-js #ref-block-post-23769 .ref-block__thumbnail { background-image: url(\"https:\/\/assets.hongkiat.com\/uploads\/thumbs\/250x160\/choosing-right-javascript-mvc-framework.jpg\"); }<\/style>\n<\/noscript>\n\t\t\t\t\t\t<\/div>\n<div class=\"ref-block__summary\">\n<h4 class=\"ref-title\">Choosing the Right JavaScript MVC Framework [Infographic]<\/h4>\n<p class=\"ref-description\">\n\t\t\t\t\t\tWith web design and development evolving at a fast pace in the past couple of years, more and...\t\t\t\t\t\t<span>Read more<\/span><\/p>\n<\/div>\n<\/div>\n<p>React is the <strong>View layer from the <abbr title=\"Model-View-Controller\">MVC<\/abbr> software design pattern<\/strong>, and it mainly <strong>focuses on DOM manipulation<\/strong>. As these days everyone talks about React, in this post we are taking a look at how you can <strong>get started with it<\/strong>.<\/p>\n<figure><a rel=\"nofollow noopener\" target=\"_blank\" href=\"https:\/\/reactjs.org\/\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/assets.hongkiat.com\/uploads\/getting-started-react-js\/react-home.jpg?newedit\" width=\"800\" height=\"407\" alt=\"React Home Page\"><\/a><\/figure>\n<h2>Install React<\/h2>\n<p>You can install React either <strong>with the npm package manager<\/strong> or by <strong>adding the necessary libraries manually<\/strong> to your HTML page. It\u2019s recommended <strong>using React with <a rel=\"nofollow noopener\" target=\"_blank\" href=\"https:\/\/babeljs.io\/\">Babel<\/a><\/strong> that allows you to <strong>use the ECMAScript6 syntax and <a href=\"https:\/\/jsx.github.io\/\">JSX<\/a><\/strong> in your React code.<\/p>\n<div class=\"ref-block ref-block--post\" id=\"ref-post-2\">\n\t\t\t\t\t<a href=\"https:\/\/www.hongkiat.com\/blog\/ecmascript-6\/\" class=\"ref-block__link\" title=\"Read More: ECMAScript 6 \u2013 10 Awesome New Features\" rel=\"bookmark\"><span class=\"screen-reader-text\">ECMAScript 6 \u2013 10 Awesome New Features<\/span><\/a>\n<div class=\"ref-block__thumbnail img-thumb img-thumb--jumbo\" data-img='{ \"src\" : \"https:\/\/assets.hongkiat.com\/uploads\/thumbs\/250x160\/ecmascript-6.jpg\" }'>\n\t\t\t\t\t\t\t<noscript>\n<style>.no-js #ref-block-post-25389 .ref-block__thumbnail { background-image: url(\"https:\/\/assets.hongkiat.com\/uploads\/thumbs\/250x160\/ecmascript-6.jpg\"); }<\/style>\n<\/noscript>\n\t\t\t\t\t\t<\/div>\n<div class=\"ref-block__summary\">\n<h4 class=\"ref-title\">ECMAScript 6 \u2013 10 Awesome New Features<\/h4>\n<p class=\"ref-description\">\n\t\t\t\t\t\tDid you know that JavaScript (along with JScript and ActionScript) is an implementation of a general-purpose client-side scripting...\t\t\t\t\t\t<span>Read more<\/span><\/p>\n<\/div>\n<\/div>\n<p>If you want to <strong>install React manually<\/strong>, the official docs recommend to <strong>use <a rel=\"nofollow noopener\" target=\"_blank\" href=\"https:\/\/github.com\/reactjs\/reactjs.org\/blob\/main\/static\/html\/single-file-example.html\">this HTML file<\/a><\/strong>. You can download the page by clicking the <code>File &gt; Save Page As...<\/code> menu in your browser. The scripts you\u2019ll need (React, React DOM, Babel) will also get downloaded into the <code>react-example_files\/<\/code> folder. Then, add the following script tags to the <code>&lt;head&gt;<\/code> section of your HTML document:<\/p>\n<pre>\r\n &lt;script src=\"react-example_files\/react.js\"&gt;&lt;\/script&gt;\r\n &lt;script src=\"react-example_files\/react-dom.js\"&gt;&lt;\/script&gt;\r\n &lt;script src=\"react-example_files\/babel.js\"&gt;&lt;\/script&gt;\r\n<\/pre>\n<p>Instead of downloading them, you can add the React scripts <strong>from CDN<\/strong> as well.<\/p>\n<pre>\r\n&lt;script src=\"https:\/\/unpkg.com\/react@15\/dist\/react.js\"&gt;&lt;\/script&gt;\r\n&lt;script src=\"https:\/\/unpkg.com\/react-dom@15\/dist\/react-dom.js\"&gt;&lt;\/script&gt;\r\n<\/pre>\n<p>You can also use the <strong>minified versions<\/strong> of the above JavaScript files:<\/p>\n<pre>\r\n&lt;script src=\"https:\/\/unpkg.com\/react@15\/dist\/react.min.js\"&gt;&lt;\/script&gt;\r\n&lt;script src=\"https:\/\/unpkg.com\/react-dom@15\/dist\/react-dom.min.js\"&gt;&lt;\/script&gt;\r\n<\/pre>\n<p>If you\u2019d rather <strong>install React with npm<\/strong>, the best way is to use the <strong><a href=\"https:\/\/github.com\/facebook\/create-react-app\">Create React App<\/a><\/strong> Github repo created by <a href=\"https:\/\/github.com\/facebookincubator\">Facebook Incubator<\/a> \u2014 this is also the solution that the <a href=\"https:\/\/reactjs.org\/docs\/installation.html\">React docs<\/a> recommend. Apart from React, it also <strong>contains Webpack, Babel, Autoprefixer, ESLint, and other developer tools<\/strong>. To get started, use the following CLI commands:<\/p>\n<pre>\r\nnpm install -g create-react-app\r\ncreate-react-app my-app\r\ncd my-app\r\nnpm start\r\n<\/pre>\n<p>When you\u2019re ready, you can <strong>access your new React app<\/strong> on the <code>localhost:3000<\/code> URL:<\/p>\n<figure><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/assets.hongkiat.com\/uploads\/getting-started-react-js\/npm-starter-app.jpg?newedit\" width=\"800\" height=\"424\" alt=\"NPM starter app\"><\/figure>\n<p>If you want to read more on <strong>how to install React<\/strong>, check out the <strong><a href=\"https:\/\/reactjs.org\/docs\/installation.html\">installation guideline<\/a><\/strong> of the docs.<\/p>\n<h2>React and JSX<\/h2>\n<p>Although it\u2019s not compulsory, you can <strong>use the JSX syntax<\/strong> in your React apps. JSX stands for <strong>JavaScript XML<\/strong>, and it <strong>transpiles into regular JavaScript<\/strong>. The big advantage of JSX is that it <strong>lets you include HTML in your JavaScript files<\/strong>, therefore it makes defining React elements easier.<\/p>\n<p>Here are the most important things to know about JSX:<\/p>\n<ol>\n<li>Tags that <strong>start with lowercase<\/strong> (lower camel case) are rendered <strong>as regular HTML elements<\/strong>.<\/li>\n<li>Tags that <strong>start with uppercase<\/strong> (upper camel case) are rendered <strong>as React components<\/strong>.<\/li>\n<li>Any code <strong>written within curly braces {\u2026}<\/strong> are interpreted <strong>as literal JavaScript<\/strong>.<\/li>\n<\/ol>\n<p>If you want to know more about <strong>how to use JSX with React<\/strong> check out <a href=\"https:\/\/reactjs.org\/docs\/introducing-jsx.html\">this page<\/a> from the docs, and for the <strong>default JSX documentation<\/strong> you can take a look at the <a href=\"https:\/\/github.com\/jsx\/JSX\/wiki\">JSX wiki<\/a>.<\/p>\n<h2>Create React elements<\/h2>\n<p>React has a <strong>component-based architecture<\/strong> in which developers create <strong>reusable components<\/strong> in order to solve different problems. A React component is built up of some or many <strong>React elements<\/strong> that are <strong>the smallest units of React apps<\/strong>.<\/p>\n<p>Below, you can see <strong>a simple example of a React element<\/strong> that adds a <span class=\"key\">Click me<\/span> button to an HTML page. In the HTML, we add a <code>&lt;div&gt;<\/code> container with the <code>\"myDiv\"<\/code> ID that will be <strong>populated with the React element<\/strong>. We create our React element within a <code>&lt;script&gt;<\/code> tag, right before the ending <code>&lt;\/body&gt;<\/code> tag. Note that if you want to <strong>use the JSX syntax<\/strong>, you need to add the <code>type=\"text\/babel\"<\/code> attribute in order to <strong>make Babel perform the compiling<\/strong>.<\/p>\n<pre>\r\n&lt;body&gt;\r\n &lt;div id=\"myDiv\"&gt;&lt;\/div&gt;\r\n\r\n &lt;script type=\"text\/babel\"&gt;\r\n   ReactDOM.render(\r\n     &lt;button&gt;Click me&lt;\/button&gt;,\r\n     document.getElementById('myDiv')\r\n   );\r\n &lt;\/script&gt;\r\n&lt;\/body&gt;\r\n<\/pre>\n<p>We render our React element with the <strong><a href=\"https:\/\/reactjs.org\/docs\/react-dom.html#render\"><code>ReactDOM.render()<\/code><\/a> method<\/strong> which <strong>takes two required parameters<\/strong>, the <strong>React element<\/strong> (<code>&lt;button&gt;Click me&lt;\/button&gt;<\/code>) and <strong>its container<\/strong> (<code>document.getElementById('myDiv')<\/code>). You can read more on <strong>how React elements work<\/strong> in the <a href=\"https:\/\/reactjs.org\/docs\/rendering-elements.html\">\u201cRendering Elements\u201d section<\/a> of the docs.<\/p>\n<h2>Create components<\/h2>\n<p><strong>React components<\/strong> are <strong>reusable, independent UI units<\/strong> in which you can easily update the data. A component can be made of one or many React elements. <strong>Props<\/strong> are <strong>arbitrary inputs<\/strong> you can use to pass data to a component. A React component works similar to JavaScript functions\u2014every time it\u2019s invoked, it <strong>generates some kind of output<\/strong>.<\/p>\n<p>You can use either the <strong>classic function syntax<\/strong> or the new <strong><a href=\"https:\/\/developer.mozilla.org\/en\/docs\/Web\/JavaScript\/Reference\/Classes\">ES6 class syntax<\/a><\/strong> to <strong>define a React component<\/strong>. In this article, I\u2019ll use the latter, as Babel allows us to use ECMAScript 6. If you are interested in how to create a component without ES6, take a look at the <a href=\"https:\/\/reactjs.org\/docs\/components-and-props.html\">Components and Props page<\/a> of the docs.<\/p>\n<p>Below, you can see the <strong>simple React component<\/strong> we are going to create as an example. It\u2019s a basic notification that the user sees after logging into a site. There are three pieces of data that will <strong>change from case to case<\/strong>: the name of the user, the number of messages, and the number of notifications, we will pass these <strong>as props<\/strong>.<\/p>\n<figure><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/assets.hongkiat.com\/uploads\/getting-started-react-js\/hi-john-doe.jpg?newedit\" width=\"700\" height=\"212\" alt=\"React component example\"><\/figure>\n<p>Each React component is a JavaScript class that <strong>extends the <code>React.Component<\/code> base class<\/strong>. Our component will be called <code>Stats<\/code> as it provides the user with a basic statistic. First, we <strong>create the <code>Stats<\/code> class<\/strong> with the <code>class Stats extends React.Component{\u2026}<\/code> syntax, then we <strong>render it to the screen<\/strong> by calling the <code>ReactDOM.render()<\/code> method (we\u2019ve already used the latter in the previous section).<\/p>\n<pre>\r\nclass Stats extends React.Component {\r\n  render() {\r\n    return(\r\n       &lt;p className=\"summary\"&gt;\r\n         Hi {this.props.name}, you have {this.props.notifications}\r\n         new notifications and {this.props.messages} new messages.\r\n       &lt;\/p&gt;\r\n    );\r\n  }\r\n}\r\n\r\nReactDOM.render(\r\n  &lt;Stats name=\"John Doe\" notifications={5} messages={2} \/&gt;,\r\n  document.getElementById(\"myStats\")\r\n);\r\n<\/pre>\n<p>The first argument of the <code>ReactDOM.render()<\/code> method consists of <strong>the name of our React component<\/strong> (<code>&lt;Stats \/&gt;<\/code>), and <strong>its props<\/strong> (<code>name<\/code>, <code>notifications<\/code>, and <code>messages<\/code>) with their values. When we declare the values of the props, strings are to be <strong>enclosed in quotation marks<\/strong> (like <code>\"John Doe\"<\/code>) and numeric values <strong>within curly brackets<\/strong> (like <code>{3}<\/code>).<\/p>\n<p>Note that because of JavaScript, we <strong>used <code>className<\/code> instead of <code>class<\/code><\/strong> in order to pass a class attribute to an HTML tag (<code>className=\"summary\"<\/code>).<\/p>\n<p>The matching HTML page is the following:<\/p>\n<pre>\r\n&lt;html&gt;\r\n &lt;head&gt;\r\n  &lt;meta charset=\"utf-8\"&gt;\r\n  &lt;script src=\"vendors\/react.js\"&gt;&lt;\/script&gt;\r\n  &lt;script src=\"vendors\/react-dom.js\"&gt;&lt;\/script&gt;\r\n  &lt;script src=\"vendors\/babel.js\"&gt;&lt;\/script&gt;\r\n &lt;\/head&gt;\r\n &lt;body&gt;\r\n   &lt;div id=\"myStats\"&gt;&lt;\/div&gt;\r\n   &lt;script type=\"text\/babel\" src=\"component.js\"&gt;&lt;\/script&gt;\r\n &lt;\/body&gt;\r\n&lt;\/html&gt;\r\n<\/pre>\n<p><a href=\"https:\/\/reactjs.org\/docs\/components-and-props.html\">In the React docs<\/a>, there are many other cool examples on <strong>how to build & manage React components<\/strong>, and <strong>what else to know about props<\/strong>.<\/p>\n<div class=\"ref-block ref-block--post\" id=\"ref-post-3\">\n\t\t\t\t\t<a href=\"https:\/\/www.hongkiat.com\/blog\/react-mdl\/\" class=\"ref-block__link\" title=\"Read More: React MDL Merges React with Material Design Lite\" rel=\"bookmark\"><span class=\"screen-reader-text\">React MDL Merges React with Material Design Lite<\/span><\/a>\n<div class=\"ref-block__thumbnail img-thumb img-thumb--jumbo\" data-img='{ \"src\" : \"https:\/\/assets.hongkiat.com\/uploads\/thumbs\/250x160\/react-mdl.jpg\" }'>\n\t\t\t\t\t\t\t<noscript>\n<style>.no-js #ref-block-post-29200 .ref-block__thumbnail { background-image: url(\"https:\/\/assets.hongkiat.com\/uploads\/thumbs\/250x160\/react-mdl.jpg\"); }<\/style>\n<\/noscript>\n\t\t\t\t\t\t<\/div>\n<div class=\"ref-block__summary\">\n<h4 class=\"ref-title\">React MDL Merges React with Material Design Lite<\/h4>\n<p class=\"ref-description\">\n\t\t\t\t\t\tGoogle recently put out a library called Material Design Lite which is a frontend resource for developers. It...\t\t\t\t\t\t<span>Read more<\/span><\/p>\n<\/div>\n<\/div>\n<h2>Further reading<\/h2>\n<p>With React, Facebook introduced <strong>a new kind of framework<\/strong> into front-end development that <strong>challenges the MV* design pattern<\/strong>. If you want to understand better how it works and what you can and cannot achieve with it, here are some interesting articles that can help:<\/p>\n<ul>\n<li>Facebook\u2019s blog post on <strong><a href=\"https:\/\/reactjs.org\/blog\/2013\/06\/05\/why-react.html\">why they built React<\/a><\/strong>.<\/li>\n<li>Andrew Ray\u2019s brilliant blog post <strong><a href=\"https:\/\/blog.andrewray.me\/reactjs-for-stupid-people\/\">on the good and the bad of React<\/a><\/strong>.<\/li>\n<li>Codementor on <strong><a href=\"https:\/\/www.codementor.io\/@chrisharrington\/react-vs-angularjs-8t6f1ioan\">how React and AngularJS compare<\/a><\/strong>.<\/li>\n<li>FreeCodeCamp\u2019s think piece on whether <strong><a href=\"https:\/\/www.freecodecamp.org\/news\/is-mvc-dead-for-the-frontend-35b4d1fe39ec\/#.3nw1h1lbc\">MVC is dead on the front-end<\/a><\/strong>.<\/li>\n<li>HackerNoon\u2019s article on <strong><a href=\"https:\/\/hackernoon.com\/react-at-60fps-4e36b8189a4c#.2bxevxxc3\">how to optimize React-related performance<\/a><\/strong>.<\/li>\n<\/ul>","protected":false},"excerpt":{"rendered":"<p>React.js is a flexible and component-based JavaScript library for building interactive user interfaces. It was created and open-sourced by Facebook and is used by many leading tech companies such as Dropbox, AirBnB, PayPal, and Netflix. React allows developers to create data-heavy apps that can be painlessly updated by re-rendering only the necessary components. React is&hellip;<\/p>\n","protected":false},"author":146,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[3392],"tags":[3497,4117,511],"topic":[4520],"class_list":["entry-content","is-maxi"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v22.8 (Yoast SEO v27.4) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>Getting Started with React.js - Hongkiat<\/title>\n<meta name=\"description\" content=\"React.js is a flexible and component-based JavaScript library for building interactive user interfaces. It was created and open-sourced by Facebook and is\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.hongkiat.com\/blog\/getting-started-react-js\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Getting Started with React.js\" \/>\n<meta property=\"og:description\" content=\"React.js is a flexible and component-based JavaScript library for building interactive user interfaces. It was created and open-sourced by Facebook and is\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.hongkiat.com\/blog\/getting-started-react-js\/\" \/>\n<meta property=\"og:site_name\" content=\"Hongkiat\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/hongkiatcom\" \/>\n<meta property=\"article:published_time\" content=\"2017-01-30T15:01:53+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-04-03T18:49:33+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/assets.hongkiat.com\/uploads\/getting-started-react-js\/react-home.jpg?newedit\" \/>\n<meta name=\"author\" content=\"Anna Monus\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@hongkiat\" \/>\n<meta name=\"twitter:site\" content=\"@hongkiat\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Anna Monus\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"6 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/getting-started-react-js\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/getting-started-react-js\\\/\"},\"author\":{\"name\":\"Anna Monus\",\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/#\\\/schema\\\/person\\\/a601053a0ab457901e00cdc83bd5359e\"},\"headline\":\"Getting Started with React.js\",\"datePublished\":\"2017-01-30T15:01:53+00:00\",\"dateModified\":\"2025-04-03T18:49:33+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/getting-started-react-js\\\/\"},\"wordCount\":1038,\"commentCount\":1,\"publisher\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/getting-started-react-js\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/assets.hongkiat.com\\\/uploads\\\/getting-started-react-js\\\/react-home.jpg?newedit\",\"keywords\":[\"Javascript Library\",\"Javascripts\",\"Web Developers\"],\"articleSection\":[\"Coding\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/getting-started-react-js\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/getting-started-react-js\\\/\",\"url\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/getting-started-react-js\\\/\",\"name\":\"Getting Started with React.js - Hongkiat\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/getting-started-react-js\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/getting-started-react-js\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/assets.hongkiat.com\\\/uploads\\\/getting-started-react-js\\\/react-home.jpg?newedit\",\"datePublished\":\"2017-01-30T15:01:53+00:00\",\"dateModified\":\"2025-04-03T18:49:33+00:00\",\"description\":\"React.js is a flexible and component-based JavaScript library for building interactive user interfaces. It was created and open-sourced by Facebook and is\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/getting-started-react-js\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/getting-started-react-js\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/getting-started-react-js\\\/#primaryimage\",\"url\":\"https:\\\/\\\/assets.hongkiat.com\\\/uploads\\\/getting-started-react-js\\\/react-home.jpg?newedit\",\"contentUrl\":\"https:\\\/\\\/assets.hongkiat.com\\\/uploads\\\/getting-started-react-js\\\/react-home.jpg?newedit\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/getting-started-react-js\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Getting Started with React.js\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/\",\"name\":\"Hongkiat\",\"description\":\"Tech and Design Tips\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/#organization\",\"name\":\"Hongkiat.com\",\"url\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/wp-content\\\/uploads\\\/hkdc-logo-rect-yoast.jpg\",\"contentUrl\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/wp-content\\\/uploads\\\/hkdc-logo-rect-yoast.jpg\",\"width\":1200,\"height\":799,\"caption\":\"Hongkiat.com\"},\"image\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/hongkiatcom\",\"https:\\\/\\\/x.com\\\/hongkiat\",\"https:\\\/\\\/www.pinterest.com\\\/hongkiat\\\/\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/#\\\/schema\\\/person\\\/a601053a0ab457901e00cdc83bd5359e\",\"name\":\"Anna Monus\",\"description\":\"Anna is Technical Editor and Writer for Hongkiat.com. She mainly covers front-end frameworks, web standards, accessibility, WordPress development, and UX design.\",\"sameAs\":[\"https:\\\/\\\/www.annalytic.com\\\/\"],\"url\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/author\\\/anna_monus\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Getting Started with React.js - Hongkiat","description":"React.js is a flexible and component-based JavaScript library for building interactive user interfaces. It was created and open-sourced by Facebook and is","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.hongkiat.com\/blog\/getting-started-react-js\/","og_locale":"en_US","og_type":"article","og_title":"Getting Started with React.js","og_description":"React.js is a flexible and component-based JavaScript library for building interactive user interfaces. It was created and open-sourced by Facebook and is","og_url":"https:\/\/www.hongkiat.com\/blog\/getting-started-react-js\/","og_site_name":"Hongkiat","article_publisher":"https:\/\/www.facebook.com\/hongkiatcom","article_published_time":"2017-01-30T15:01:53+00:00","article_modified_time":"2025-04-03T18:49:33+00:00","og_image":[{"url":"https:\/\/assets.hongkiat.com\/uploads\/getting-started-react-js\/react-home.jpg?newedit","type":"","width":"","height":""}],"author":"Anna Monus","twitter_card":"summary_large_image","twitter_creator":"@hongkiat","twitter_site":"@hongkiat","twitter_misc":{"Written by":"Anna Monus","Est. reading time":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.hongkiat.com\/blog\/getting-started-react-js\/#article","isPartOf":{"@id":"https:\/\/www.hongkiat.com\/blog\/getting-started-react-js\/"},"author":{"name":"Anna Monus","@id":"https:\/\/www.hongkiat.com\/blog\/#\/schema\/person\/a601053a0ab457901e00cdc83bd5359e"},"headline":"Getting Started with React.js","datePublished":"2017-01-30T15:01:53+00:00","dateModified":"2025-04-03T18:49:33+00:00","mainEntityOfPage":{"@id":"https:\/\/www.hongkiat.com\/blog\/getting-started-react-js\/"},"wordCount":1038,"commentCount":1,"publisher":{"@id":"https:\/\/www.hongkiat.com\/blog\/#organization"},"image":{"@id":"https:\/\/www.hongkiat.com\/blog\/getting-started-react-js\/#primaryimage"},"thumbnailUrl":"https:\/\/assets.hongkiat.com\/uploads\/getting-started-react-js\/react-home.jpg?newedit","keywords":["Javascript Library","Javascripts","Web Developers"],"articleSection":["Coding"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.hongkiat.com\/blog\/getting-started-react-js\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.hongkiat.com\/blog\/getting-started-react-js\/","url":"https:\/\/www.hongkiat.com\/blog\/getting-started-react-js\/","name":"Getting Started with React.js - Hongkiat","isPartOf":{"@id":"https:\/\/www.hongkiat.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.hongkiat.com\/blog\/getting-started-react-js\/#primaryimage"},"image":{"@id":"https:\/\/www.hongkiat.com\/blog\/getting-started-react-js\/#primaryimage"},"thumbnailUrl":"https:\/\/assets.hongkiat.com\/uploads\/getting-started-react-js\/react-home.jpg?newedit","datePublished":"2017-01-30T15:01:53+00:00","dateModified":"2025-04-03T18:49:33+00:00","description":"React.js is a flexible and component-based JavaScript library for building interactive user interfaces. It was created and open-sourced by Facebook and is","breadcrumb":{"@id":"https:\/\/www.hongkiat.com\/blog\/getting-started-react-js\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.hongkiat.com\/blog\/getting-started-react-js\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.hongkiat.com\/blog\/getting-started-react-js\/#primaryimage","url":"https:\/\/assets.hongkiat.com\/uploads\/getting-started-react-js\/react-home.jpg?newedit","contentUrl":"https:\/\/assets.hongkiat.com\/uploads\/getting-started-react-js\/react-home.jpg?newedit"},{"@type":"BreadcrumbList","@id":"https:\/\/www.hongkiat.com\/blog\/getting-started-react-js\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.hongkiat.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Getting Started with React.js"}]},{"@type":"WebSite","@id":"https:\/\/www.hongkiat.com\/blog\/#website","url":"https:\/\/www.hongkiat.com\/blog\/","name":"Hongkiat","description":"Tech and Design Tips","publisher":{"@id":"https:\/\/www.hongkiat.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.hongkiat.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.hongkiat.com\/blog\/#organization","name":"Hongkiat.com","url":"https:\/\/www.hongkiat.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.hongkiat.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/www.hongkiat.com\/blog\/wp-content\/uploads\/hkdc-logo-rect-yoast.jpg","contentUrl":"https:\/\/www.hongkiat.com\/blog\/wp-content\/uploads\/hkdc-logo-rect-yoast.jpg","width":1200,"height":799,"caption":"Hongkiat.com"},"image":{"@id":"https:\/\/www.hongkiat.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/hongkiatcom","https:\/\/x.com\/hongkiat","https:\/\/www.pinterest.com\/hongkiat\/"]},{"@type":"Person","@id":"https:\/\/www.hongkiat.com\/blog\/#\/schema\/person\/a601053a0ab457901e00cdc83bd5359e","name":"Anna Monus","description":"Anna is Technical Editor and Writer for Hongkiat.com. She mainly covers front-end frameworks, web standards, accessibility, WordPress development, and UX design.","sameAs":["https:\/\/www.annalytic.com\/"],"url":"https:\/\/www.hongkiat.com\/blog\/author\/anna_monus\/"}]}},"jetpack_featured_media_url":"https:\/\/","jetpack_shortlink":"https:\/\/wp.me\/p4uxU-7yO","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/posts\/29066","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/users\/146"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/comments?post=29066"}],"version-history":[{"count":4,"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/posts\/29066\/revisions"}],"predecessor-version":[{"id":73735,"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/posts\/29066\/revisions\/73735"}],"wp:attachment":[{"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/media?parent=29066"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/categories?post=29066"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/tags?post=29066"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/topic?post=29066"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}