{"id":255,"date":"2018-03-08T09:29:59","date_gmt":"2018-03-08T09:29:59","guid":{"rendered":"http:\/\/blog.amt.in\/?p=255"},"modified":"2018-03-08T09:29:59","modified_gmt":"2018-03-08T09:29:59","slug":"introduction-to-reactjs","status":"publish","type":"post","link":"https:\/\/blog.amt.in\/index.php\/2018\/03\/08\/introduction-to-reactjs\/","title":{"rendered":"Introduction to ReactJS"},"content":{"rendered":"<p>React is a declarative, efficient, and flexible JavaScript library for building user interfaces..\u00c2\u00a0React allows developers to create large web-applications that use data and can change over time without reloading the page. It aims primarily to provide speed, simplicity, and scalability. React processes only user interfaces in applications. This corresponds to View in the\u00c2\u00a0Model-View-Controller\u00c2\u00a0(MVC) pattern, and can be used in combination with other\u00c2\u00a0JavaScript\u00c2\u00a0libraries or frameworks in MVC, such as\u00c2\u00a0AngularJS.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-260 alignleft\" src=\"http:\/\/blog.amt.in\/wp-content\/uploads\/2018\/03\/ReactJS-Inside-Blog-image.png\" alt=\"\" width=\"440\" height=\"310\" \/><\/p>\n<p>Features of ReactJS:<\/p>\n<p><span id=\"One-way_data_flow\" class=\"mw-headline\">One-way data flow<\/span><\/p>\n<p>To use React to its greatest potential, Properties (or props), ideally a set of immutable values, are passed to a component&#8217;s render function. A component should not directly modify any properties passed to it, but should be passed callback functions that instead modifies the store creating a single source of truth. This mechanism&#8217;s promise is expressed as &#8220;properties flow down; actions flow up&#8221;. The described mechanism is an architecture called Flux.\u00c2\u00a0Many Flux alternatives have been created since its inception however the community has moved toward\u00c2\u00a0Redux.<\/p>\n<p><span id=\"Virtual_DOM\" class=\"mw-headline\">Virtual DOM<\/span><\/p>\n<p>Another notable feature is the use of a &#8220;virtual\u00c2\u00a0Document Object Model&#8221;, or &#8220;virtual DOM&#8221;. React creates an in-memory data structure cache, computes the resulting differences, and then updates the browser&#8217;s displayed DOM efficiently.\u00c2\u00a0This allows the programmer to write code as if the entire page is rendered on each change, while the React libraries only render sub components that actually change.<\/p>\n<p><span id=\"JSX\" class=\"mw-headline\">JSX<\/span><\/p>\n<p>React components are typically written in JSX, a JavaScript extension syntax allowing quoting of HTML and using HTML tag syntax to render subcomponents.<span style=\"font-size: 14.1667px;\">\u00c2\u00a0<\/span>This is a React-specific grammar extension to JavaScript like the now-defunct\u00c2\u00a0E4X. HTML syntax is processed into JavaScript calls of the React framework. Developers may also write in pure JavaScript. JSX is similar to another extension syntax created by Facebook for PHP,\u00c2\u00a0XHP. JSX looks like regular HTML.<\/p>\n<p>React uses JSX for templating instead of regular JavaScript. It is not necessary to use it, however, following are some pros that come with it.<\/p>\n<ul class=\"list\">\n<li>It is faster because it performs optimization while compiling code to JavaScript.<\/li>\n<li>It is also type-safe and most of the errors can be caught during compilation.<\/li>\n<li>It makes it easier and faster to write templates, if you are familiar with HTML.<\/li>\n<\/ul>\n<p>As of React v16.0 it is now possible to return an array of elements, fragments and strings.<\/p>\n<p>The above mentioned is a brief about ReactJS. Watch this space for more Blogs on latest trends and Information in Technology that is needed in the current generation.<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>React is a declarative, efficient,<\/p>\n","protected":false},"author":1,"featured_media":258,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[30,85,7],"tags":[14,86,18],"class_list":["post-255","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-javascript","category-reactjs","category-techtrends","tag-javascript","tag-reactjs","tag-technology"],"_links":{"self":[{"href":"https:\/\/blog.amt.in\/index.php\/wp-json\/wp\/v2\/posts\/255","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.amt.in\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.amt.in\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.amt.in\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.amt.in\/index.php\/wp-json\/wp\/v2\/comments?post=255"}],"version-history":[{"count":3,"href":"https:\/\/blog.amt.in\/index.php\/wp-json\/wp\/v2\/posts\/255\/revisions"}],"predecessor-version":[{"id":261,"href":"https:\/\/blog.amt.in\/index.php\/wp-json\/wp\/v2\/posts\/255\/revisions\/261"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.amt.in\/index.php\/wp-json\/wp\/v2\/media\/258"}],"wp:attachment":[{"href":"https:\/\/blog.amt.in\/index.php\/wp-json\/wp\/v2\/media?parent=255"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.amt.in\/index.php\/wp-json\/wp\/v2\/categories?post=255"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.amt.in\/index.php\/wp-json\/wp\/v2\/tags?post=255"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}