{"id":17075,"date":"2017-05-09T12:15:02","date_gmt":"2017-05-09T09:15:02","guid":{"rendered":"https:\/\/www.webcodegeeks.com\/?p=17075"},"modified":"2017-05-08T11:09:46","modified_gmt":"2017-05-08T08:09:46","slug":"rendering-restful-service-react","status":"publish","type":"post","link":"https:\/\/www.webcodegeeks.com\/javascript\/rendering-restful-service-react\/","title":{"rendered":"Rendering RESTful service with React"},"content":{"rendered":"<p>Looking at the popularity of <a href=\"https:\/\/facebook.github.io\/react\/\" target=\"_blank\" rel=\"noopener noreferrer\">React<\/a>, I thought of learning it and creating a simple UI which will render data from <strong>RESTful<\/strong> service.<\/p>\n<p>With this post, I will try to replicate the steps I followed while writing it along with references. Before starting, let me give you a brief introduction about React.<\/p>\n<h2>What is React?<\/h2>\n<p>React is a declarative, efficient, and flexible JavaScript library for building user interfaces. It uses virtual DOM which improve apps performance since JavaScript virtual DOM is faster than the regular DOM with a limitation that it only covers view layer of the app so you still need to choose other technologies to get a complete tooling set for development.<\/p>\n<p>Now, lets\u2019 start with creating <strong>react-app<\/strong> running on port <strong>8080<\/strong>, following below steps:<\/p>\n<p><strong>Step 1:<\/strong> Go to <a href=\"http:\/\/start.spring.io\/\" target=\"_blank\" rel=\"noopener noreferrer\">start.spring.io<\/a> and create a new project <strong>react-app<\/strong> adding the Thymeleaf starters, based on the following image:<\/p>\n<p><a href=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2017\/05\/screen-shot-2017-05-06-at-2-53-30-pm.png\"><img decoding=\"async\" class=\"aligncenter size-full wp-image-17077\" src=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2017\/05\/screen-shot-2017-05-06-at-2-53-30-pm.png\" alt=\"\" width=\"648\" height=\"305\" srcset=\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2017\/05\/screen-shot-2017-05-06-at-2-53-30-pm.png 648w, https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2017\/05\/screen-shot-2017-05-06-at-2-53-30-pm-300x141.png 300w\" sizes=\"(max-width: 648px) 100vw, 648px\" \/><\/a><br \/>\n<strong>Step 2:<\/strong> Edit <strong>ReactAppApplication.java<\/strong> to add a method which returns a list of employee, as follows:<\/p>\n<pre class=\"brush:java\">package com.arpit.react.app;\r\n\r\nimport java.util.ArrayList;\r\nimport java.util.List;\r\nimport org.springframework.boot.SpringApplication;\r\nimport org.springframework.boot.autoconfigure.SpringBootApplication;\r\nimport org.springframework.stereotype.Controller;\r\nimport org.springframework.web.bind.annotation.GetMapping;\r\nimport org.springframework.web.bind.annotation.RestController;\r\n\r\n@SpringBootApplication\r\n@RestController\r\npublic class ReactAppApplication {\r\n\r\n\tpublic static void main(String[] args) {\r\n\t\tSpringApplication.run(ReactAppApplication.class, args);\r\n\t}\r\n\r\n\t@GetMapping(\"\/employee\/get\")\r\n\tpublic List&lt;Employee&gt; get() {\r\n\t\tList&lt;Employee&gt; employeeList = new ArrayList&lt;&gt;();\r\n\t\temployeeList.add(new Employee(1, \"Arpit\", \"IT\"));\r\n\t\temployeeList.add(new Employee(2, \"Sanjeev\", \"IT\"));\r\n\t\treturn employeeList;\r\n\t}\r\n}\r\n\r\n@Controller\r\nclass IndexPageController {\r\n\r\n\t@GetMapping(value = \"\/\")\r\n\tpublic String index() {\r\n\t\treturn \"index\";\r\n\t}\r\n}\r\n\r\nfinal class Employee {\r\n\r\n\tprivate int id;\r\n\tprivate String name;\r\n\tprivate String department;\r\n\r\n\tpublic Employee() {\r\n\r\n\t}\r\n\r\n\tpublic Employee(final int id, final String name, final String department) {\r\n\t\tthis.id = id;\r\n\t\tthis.name = name;\r\n\t\tthis.department = department;\r\n\t}\r\n\r\n\tpublic int getId() {\r\n\t\treturn id;\r\n\t}\r\n\r\n\tpublic void setId(int id) {\r\n\t\tthis.id = id;\r\n\t}\r\n\r\n\tpublic String getName() {\r\n\t\treturn name;\r\n\t}\r\n\r\n\tpublic void setName(String name) {\r\n\t\tthis.name = name;\r\n\t}\r\n\r\n\tpublic String getDepartment() {\r\n\t\treturn department;\r\n\t}\r\n\r\n\tpublic void setDepartment(String department) {\r\n\t\tthis.department = department;\r\n\t}\r\n}<\/pre>\n<p><strong>IndexPageController<\/strong> define index() method flagged by <strong>@GetMapping(value = \u201c\/\u201d)<\/strong> to support the <code><strong>\/<\/strong><\/code> route. It returns index as the name of the template, which Spring Boot\u2019s autoconfigured view resolver will map to <strong>src\/main\/resources\/templates\/index.html<\/strong>.<\/p>\n<p><strong>Step 3:<\/strong> Define an HTML template <strong>src\/main\/resources\/templates\/index.html<\/strong> with the following\u00a0content:<\/p>\n<pre class=\"brush:xml\">&lt;!DOCTYPE html&gt;\r\n&lt;html xmlns:th=\"http:\/\/www.thymeleaf.org\"&gt;\r\n&lt;head lang=\"en\"&gt;\r\n&lt;meta charset=\"UTF-8\" \/&gt;\r\n&lt;title&gt;React with Spring REST&lt;\/title&gt;\r\n&lt;\/head&gt;\r\n&lt;body&gt;\r\n\t&lt;div id=\"react\"&gt;&lt;\/div&gt;\r\n\t&lt;script src=\"package\/script.js\"&gt;&lt;\/script&gt;\r\n&lt;\/body&gt;\r\n&lt;\/html&gt;<\/pre>\n<p><strong>Step 4:<\/strong> Move to <strong>react-app<\/strong> directory and run command: <code><strong>mvn spring-boot:run<\/strong><\/code>. Once running open <strong><a href=\"http:\/\/localhost:8080\/employee\/get\" rel=\"nofollow\">http:\/\/localhost:8080\/employee\/get<\/a><\/strong> which will give you the list of employees we are going to render on UI built with React.<\/p>\n<p><strong>Step 5:<\/strong> Next we will add <a href=\"https:\/\/github.com\/eirslett\/frontend-maven-plugin\" target=\"_blank\" rel=\"noopener noreferrer\">f<strong>rontend-maven-plugin<\/strong><\/a> in <strong>pom.xml<\/strong> \u00a0to install Node and NPM locally for the react-app followed by running <a href=\"https:\/\/github.com\/webpack\/webpack\" target=\"_blank\" rel=\"noopener noreferrer\">Webpack<\/a> \u00a0build, as follows:<\/p>\n<pre class=\"brush:xml\">&lt;plugin&gt;\r\n\t\t\t\t&lt;groupId&gt;com.github.eirslett&lt;\/groupId&gt;\r\n\t\t\t\t&lt;artifactId&gt;frontend-maven-plugin&lt;\/artifactId&gt;\r\n\t\t\t\t&lt;version&gt;1.2&lt;\/version&gt;\r\n\t\t\t\t&lt;configuration&gt;\r\n\t\t\t\t\t&lt;installDirectory&gt;target&lt;\/installDirectory&gt;\r\n\t\t\t\t&lt;\/configuration&gt;\r\n\t\t\t\t&lt;executions&gt;\r\n\t\t\t\t\t&lt;execution&gt;\r\n\t\t\t\t\t\t&lt;id&gt;install node and npm&lt;\/id&gt;\r\n\t\t\t\t\t\t&lt;goals&gt;\r\n\t\t\t\t\t\t\t&lt;goal&gt;install-node-and-npm&lt;\/goal&gt;\r\n\t\t\t\t\t\t&lt;\/goals&gt;\r\n\t\t\t\t\t\t&lt;configuration&gt;\r\n\t\t\t\t\t\t\t&lt;nodeVersion&gt;v4.4.5&lt;\/nodeVersion&gt;\r\n\t\t\t\t\t\t\t&lt;npmVersion&gt;3.9.2&lt;\/npmVersion&gt;\r\n\t\t\t\t\t\t&lt;\/configuration&gt;\r\n\t\t\t\t\t&lt;\/execution&gt;\r\n\t\t\t\t\t&lt;execution&gt;\r\n\t\t\t\t\t\t&lt;id&gt;npm install&lt;\/id&gt;\r\n\t\t\t\t\t\t&lt;goals&gt;\r\n\t\t\t\t\t\t\t&lt;goal&gt;npm&lt;\/goal&gt;\r\n\t\t\t\t\t\t&lt;\/goals&gt;\r\n\t\t\t\t\t\t&lt;configuration&gt;\r\n\t\t\t\t\t\t\t&lt;arguments&gt;install&lt;\/arguments&gt;\r\n\t\t\t\t\t\t&lt;\/configuration&gt;\r\n\t\t\t\t\t&lt;\/execution&gt;\r\n\t\t\t\t\t&lt;execution&gt;\r\n\t\t\t\t\t\t&lt;id&gt;webpack build&lt;\/id&gt;\r\n\t\t\t\t\t\t&lt;goals&gt;\r\n\t\t\t\t\t\t\t&lt;goal&gt;webpack&lt;\/goal&gt;\r\n\t\t\t\t\t\t&lt;\/goals&gt;\r\n\t\t\t\t\t&lt;\/execution&gt;\r\n\t\t\t\t&lt;\/executions&gt;\r\n&lt;\/plugin&gt;<\/pre>\n<p><strong>Step 6:<\/strong> Execute <code><strong>npm init<\/strong><\/code> in the root directory to create <strong>package.json<\/strong> in which we specify all the <a href=\"https:\/\/github.com\/freeCodeCamp\/freeCodeCamp\/wiki\/Installing-Dependencies-React-ES6-Webpack-Project\" target=\"_blank\" rel=\"noopener noreferrer\">dependencies<\/a> required to build our react-app like <strong>React<\/strong>, <strong>React DOM<\/strong>, <strong>Webpack<\/strong>, <strong>Babel Loader<\/strong>, <strong>Babel Core<\/strong>, B<strong>abel Preset: ES2015<\/strong>, <strong>Babel Preset: React<\/strong>, as follows:<\/p>\n<pre class=\"brush:java\">$ cd react-app\r\n$ touch npm init<\/pre>\n<p>Copy the following content:<\/p>\n<pre class=\"brush:java\">{\r\n  \"name\": \"react-app\",\r\n  \"version\": \"1.0.0\",\r\n  \"description\": \"Rendering RESTful service with React\",\r\n  \"repository\": {\r\n    \"type\": \"git\",\r\n    \"url\": \"git@github.com:arpitaggarwal\/react-app.git\"\r\n  },\r\n  \"keywords\": [\r\n    \"rest\",\r\n    \"spring\",\r\n    \"react\"\r\n  ],\r\n  \"author\": \"Arpit Aggarwal\",\r\n  \"dependencies\": {\r\n    \"axios\": \"^0.16.1\",\r\n    \"react\": \"^15.3.2\",\r\n    \"react-dom\": \"^15.3.2\",\r\n    \"webpack\": \"^1.12.2\"\r\n  },\r\n  \"scripts\": {\r\n    \"watch\": \"webpack --watch -d\"\r\n  },\r\n  \"devDependencies\": {\r\n    \"babel-core\": \"^6.18.2\",\r\n    \"babel-loader\": \"^6.2.7\",\r\n    \"babel-polyfill\": \"^6.16.0\",\r\n    \"babel-preset-es2015\": \"^6.18.0\",\r\n    \"babel-preset-react\": \"^6.16.0\"\r\n  }\r\n}<\/pre>\n<p><strong>Step 7:<\/strong> Next we will create <strong>webpack.config.js<\/strong> to configure webpack, as follows:<\/p>\n<pre class=\"brush:java\">$ cd react-app\r\n$ touch webpack.config.js<\/pre>\n<p>Copy the following\u00a0content:<\/p>\n<pre class=\"brush:java\">var path = require('path');\r\n\r\nmodule.exports = {\r\n    entry: '.\/app\/main.js',\r\n    cache: true,\r\n    debug: true,\r\n    output: {\r\n        path: __dirname,\r\n        filename: '.\/src\/main\/resources\/static\/package\/script.js'\r\n    },\r\n    module: {\r\n        loaders: [\r\n            {\r\n                test: path.join(__dirname, '.'),\r\n                exclude: \/(node_modules)\/,\r\n                loader: 'babel',\r\n                query: {\r\n                    cacheDirectory: true,\r\n                    presets: ['es2015', 'react']\r\n                }\r\n            }\r\n        ]\r\n    }\r\n};<\/pre>\n<p><strong>entry<\/strong> option specified above is the entry point for the bundle.<br \/>\n<strong>cache<\/strong> option specified above Cache generated modules and chunks to improve performance for multiple incremental builds.<br \/>\n<strong>output<\/strong> option specified above tell Webpack how to write the compiled files to disk.<\/p>\n<p>For more configuration options you can explore <a href=\"https:\/\/webpack.github.io\/docs\/configuration.html\" target=\"_blank\" rel=\"noopener noreferrer\">here<\/a>.<\/p>\n<p><strong>Step 8:<\/strong> Next we will create entry point for the webpack which is <code>react-app\/app\/main.js<\/code>, as:<\/p>\n<pre class=\"brush:java\">$ cd react-app\r\n$ mkdir app\r\n$ cd app\r\n$ touch main.js<\/pre>\n<p>Copy the following content:<\/p>\n<pre class=\"brush:java\">'use strict';\r\nconst React = require('react');\r\nconst ReactDOM = require('react-dom')\r\n\r\nimport ReactApp from '.\/components\/react-app.jsx'\r\n\r\nReactDOM.render(\r\n\t\t&lt;ReactApp \/&gt;,\r\n\tdocument.getElementById('react')\r\n)<\/pre>\n<p><strong>React<\/strong> is the main library from Facebook for building the app.<br \/>\n<strong>ReactDOM<\/strong> provides DOM-specific methods that can be used at the top level.<br \/>\n<strong>ReactApp<\/strong> is the top level container for all React components.<\/p>\n<p>Let\u2019s define <strong>ReactApp<\/strong> along with it\u2019s child components, as:<\/p>\n<pre class=\"brush:java\">$ cd react-app\/app\/\r\n$ mkdir components\r\n$ cd components\r\n$ touch react-app.jsx employee-list.jsx employee.jsx<\/pre>\n<p><strong>react-spring\/app\/components\/react-app.jsx<\/strong><\/p>\n<pre class=\"brush:java\">'use strict';\r\nconst React = require('react');\r\nvar axios = require('axios');\r\n\r\nimport EmployeeList from '.\/employee-list.jsx'\r\n\r\nexport default class ReactApp extends React.Component {\r\n\r\n\tconstructor(props) {\r\n\t\tsuper(props);\r\n\t\tthis.state = {employees: []};\r\n\t\tthis.Axios = axios.create({\r\n\t\t    baseURL: \"\/employee\",\r\n\t\t    headers: {'content-type': 'application\/json', 'creds':'user'}\r\n\t\t});\r\n\t}\r\n\r\n\tcomponentDidMount() {\r\n\t\tlet _this = this;\r\n\t\tthis.Axios.get('\/get')\r\n\t\t  .then(function (response) {\r\n\t\t     console.log(response);\r\n\t\t    _this.setState({employees: response.data});\r\n\t\t  })\r\n\t\t  .catch(function (error) {\r\n\t\t    console.log(error);\r\n\t\t  });\r\n\t}\r\n\r\n\trender() {\r\n\t\treturn (\r\n\t\t\t\t&lt;div&gt;\r\n\t\t\t\t  &lt;EmployeeList employees={this.state.employees}\/&gt;\r\n\t\t        &lt;\/div&gt;\r\n\t\t\t)\r\n\t}\r\n}<\/pre>\n<p><strong>react-spring\/app\/components\/employee-list.jsx<\/strong><\/p>\n<pre class=\"brush:java\">const React = require('react');\r\nimport Employee from '.\/employee.jsx'\r\n\r\nexport default class EmployeeList extends React.Component{\r\n    \r\n    render() {\r\n\t\tvar employees = this.props.employees.map((employee, i) =&gt;\r\n\t\t\t&lt;Employee key={i} employee={employee}\/&gt;\r\n\t\t);\r\n\t\t\r\n\t\treturn (\r\n\t\t\t&lt;table&gt;\r\n\t\t\t\t&lt;tbody&gt;\r\n\t\t\t\t\t&lt;tr&gt;\r\n\t\t\t\t\t\t&lt;th&gt;ID&lt;\/th&gt;\r\n\t\t\t\t\t\t&lt;th&gt;Name&lt;\/th&gt;\r\n\t\t\t\t\t\t&lt;th&gt;Department&lt;\/th&gt;\r\n\t\t\t\t\t&lt;\/tr&gt;\r\n\t\t\t\t\t{employees}\r\n\t\t\t\t&lt;\/tbody&gt;\r\n\t\t\t&lt;\/table&gt;\r\n\t\t)\r\n\t}\r\n}<\/pre>\n<p><strong>react-spring\/app\/components\/employee.jsx<\/strong><\/p>\n<pre class=\"brush:java\">const React = require('react');\r\n\r\nexport default class Employee extends React.Component{\r\n\trender() {\r\n\t\treturn (\r\n\t\t\t&lt;tr&gt;\r\n\t\t\t\t&lt;td&gt;{this.props.employee.id}&lt;\/td&gt;\r\n\t\t\t\t&lt;td&gt;{this.props.employee.name}&lt;\/td&gt;\r\n\t\t\t\t&lt;td&gt;{this.props.employee.department}&lt;\/td&gt;\r\n\t\t\t&lt;\/tr&gt;\r\n\t\t)\r\n\t}\r\n}<\/pre>\n<p>With all this in place, your directory structure should look like:<\/p>\n<p><a href=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2017\/05\/screen-shot-2017-05-06-at-4-49-26-pm.png\"><img decoding=\"async\" class=\"aligncenter size-full wp-image-17078\" src=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2017\/05\/screen-shot-2017-05-06-at-4-49-26-pm.png\" alt=\"\" width=\"283\" height=\"505\" srcset=\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2017\/05\/screen-shot-2017-05-06-at-4-49-26-pm.png 283w, https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2017\/05\/screen-shot-2017-05-06-at-4-49-26-pm-168x300.png 168w\" sizes=\"(max-width: 283px) 100vw, 283px\" \/><\/a><\/p>\n<p>Now re-run the application and visit <strong><a href=\"http:\/\/localhost:8080\" rel=\"nofollow\">http:\/\/localhost:8080<\/a><\/strong>.<\/p>\n<p>Complete source code is hosted on <a href=\"https:\/\/github.com\/arpitaggarwal\/react-app\" target=\"_blank\" rel=\"noopener noreferrer\">github<\/a>.<\/p>\n<div class=\"attribution\">\n<table>\n<tbody>\n<tr>\n<td><span class=\"reference\">Reference: <\/span><\/td>\n<td><a href=\"https:\/\/aggarwalarpit.wordpress.com\/2017\/05\/06\/rendering-restful-service-with-react\/\">Rendering RESTful service with React<\/a> from our <a href=\"http:\/\/www.webcodegeeks.com\/join-us\/wcg\/\">WCG partner<\/a> Arpit Aggarwal at the <a href=\"https:\/\/aggarwalarpit.wordpress.com\/\">Arpit Aggarwal<\/a> blog.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Looking at the popularity of React, I thought of learning it and creating a simple UI which will render data from RESTful service. With this post, I will try to replicate the steps I followed while writing it along with references. Before starting, let me give you a brief introduction about React. What is React? &hellip;<\/p>\n","protected":false},"author":492,"featured_media":920,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[9],"tags":[463],"class_list":["post-17075","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-javascript","tag-react-js"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Rendering RESTful service with React - Web Code Geeks - 2026<\/title>\n<meta name=\"description\" content=\"Looking at the popularity of React, I thought of learning it and creating a simple UI which will render data from RESTful service. With this post, I will\" \/>\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.webcodegeeks.com\/javascript\/rendering-restful-service-react\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Rendering RESTful service with React - Web Code Geeks - 2026\" \/>\n<meta property=\"og:description\" content=\"Looking at the popularity of React, I thought of learning it and creating a simple UI which will render data from RESTful service. With this post, I will\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.webcodegeeks.com\/javascript\/rendering-restful-service-react\/\" \/>\n<meta property=\"og:site_name\" content=\"Web Code Geeks\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/webcodegeeks\" \/>\n<meta property=\"article:published_time\" content=\"2017-05-09T09:15:02+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/js-logo.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"150\" \/>\n\t<meta property=\"og:image:height\" content=\"150\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Arpit Aggarwal\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@webcodegeeks\" \/>\n<meta name=\"twitter:site\" content=\"@webcodegeeks\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Arpit Aggarwal\" \/>\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.webcodegeeks.com\/javascript\/rendering-restful-service-react\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/javascript\/rendering-restful-service-react\/\"},\"author\":{\"name\":\"Arpit Aggarwal\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/fc489af29df9e3ed4ebaa454247c4b12\"},\"headline\":\"Rendering RESTful service with React\",\"datePublished\":\"2017-05-09T09:15:02+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/javascript\/rendering-restful-service-react\/\"},\"wordCount\":506,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/javascript\/rendering-restful-service-react\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/js-logo.jpg\",\"keywords\":[\"React.js\"],\"articleSection\":[\"JavaScript\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.webcodegeeks.com\/javascript\/rendering-restful-service-react\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.webcodegeeks.com\/javascript\/rendering-restful-service-react\/\",\"url\":\"https:\/\/www.webcodegeeks.com\/javascript\/rendering-restful-service-react\/\",\"name\":\"Rendering RESTful service with React - Web Code Geeks - 2026\",\"isPartOf\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/javascript\/rendering-restful-service-react\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/javascript\/rendering-restful-service-react\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/js-logo.jpg\",\"datePublished\":\"2017-05-09T09:15:02+00:00\",\"description\":\"Looking at the popularity of React, I thought of learning it and creating a simple UI which will render data from RESTful service. With this post, I will\",\"breadcrumb\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/javascript\/rendering-restful-service-react\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.webcodegeeks.com\/javascript\/rendering-restful-service-react\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.webcodegeeks.com\/javascript\/rendering-restful-service-react\/#primaryimage\",\"url\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/js-logo.jpg\",\"contentUrl\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/js-logo.jpg\",\"width\":150,\"height\":150},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.webcodegeeks.com\/javascript\/rendering-restful-service-react\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.webcodegeeks.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"JavaScript\",\"item\":\"https:\/\/www.webcodegeeks.com\/category\/javascript\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Rendering RESTful service with React\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#website\",\"url\":\"https:\/\/www.webcodegeeks.com\/\",\"name\":\"Web Code Geeks\",\"description\":\"Web Developers Resource Center\",\"publisher\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.webcodegeeks.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#organization\",\"name\":\"Exelixis Media P.C.\",\"url\":\"https:\/\/www.webcodegeeks.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png\",\"contentUrl\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png\",\"width\":864,\"height\":246,\"caption\":\"Exelixis Media P.C.\"},\"image\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/webcodegeeks\",\"https:\/\/x.com\/webcodegeeks\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/fc489af29df9e3ed4ebaa454247c4b12\",\"name\":\"Arpit Aggarwal\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/a0dc71e538e67766feb7c436ea43f02757eeb1f9446613ae680752be7239a3f6?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/a0dc71e538e67766feb7c436ea43f02757eeb1f9446613ae680752be7239a3f6?s=96&d=mm&r=g\",\"caption\":\"Arpit Aggarwal\"},\"sameAs\":[\"https:\/\/aggarwalarpit.wordpress.com\/\"],\"url\":\"https:\/\/www.webcodegeeks.com\/author\/arpit-aggarwal\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Rendering RESTful service with React - Web Code Geeks - 2026","description":"Looking at the popularity of React, I thought of learning it and creating a simple UI which will render data from RESTful service. With this post, I will","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.webcodegeeks.com\/javascript\/rendering-restful-service-react\/","og_locale":"en_US","og_type":"article","og_title":"Rendering RESTful service with React - Web Code Geeks - 2026","og_description":"Looking at the popularity of React, I thought of learning it and creating a simple UI which will render data from RESTful service. With this post, I will","og_url":"https:\/\/www.webcodegeeks.com\/javascript\/rendering-restful-service-react\/","og_site_name":"Web Code Geeks","article_publisher":"https:\/\/www.facebook.com\/webcodegeeks","article_published_time":"2017-05-09T09:15:02+00:00","og_image":[{"width":150,"height":150,"url":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/js-logo.jpg","type":"image\/jpeg"}],"author":"Arpit Aggarwal","twitter_card":"summary_large_image","twitter_creator":"@webcodegeeks","twitter_site":"@webcodegeeks","twitter_misc":{"Written by":"Arpit Aggarwal","Est. reading time":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.webcodegeeks.com\/javascript\/rendering-restful-service-react\/#article","isPartOf":{"@id":"https:\/\/www.webcodegeeks.com\/javascript\/rendering-restful-service-react\/"},"author":{"name":"Arpit Aggarwal","@id":"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/fc489af29df9e3ed4ebaa454247c4b12"},"headline":"Rendering RESTful service with React","datePublished":"2017-05-09T09:15:02+00:00","mainEntityOfPage":{"@id":"https:\/\/www.webcodegeeks.com\/javascript\/rendering-restful-service-react\/"},"wordCount":506,"commentCount":0,"publisher":{"@id":"https:\/\/www.webcodegeeks.com\/#organization"},"image":{"@id":"https:\/\/www.webcodegeeks.com\/javascript\/rendering-restful-service-react\/#primaryimage"},"thumbnailUrl":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/js-logo.jpg","keywords":["React.js"],"articleSection":["JavaScript"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.webcodegeeks.com\/javascript\/rendering-restful-service-react\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.webcodegeeks.com\/javascript\/rendering-restful-service-react\/","url":"https:\/\/www.webcodegeeks.com\/javascript\/rendering-restful-service-react\/","name":"Rendering RESTful service with React - Web Code Geeks - 2026","isPartOf":{"@id":"https:\/\/www.webcodegeeks.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.webcodegeeks.com\/javascript\/rendering-restful-service-react\/#primaryimage"},"image":{"@id":"https:\/\/www.webcodegeeks.com\/javascript\/rendering-restful-service-react\/#primaryimage"},"thumbnailUrl":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/js-logo.jpg","datePublished":"2017-05-09T09:15:02+00:00","description":"Looking at the popularity of React, I thought of learning it and creating a simple UI which will render data from RESTful service. With this post, I will","breadcrumb":{"@id":"https:\/\/www.webcodegeeks.com\/javascript\/rendering-restful-service-react\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.webcodegeeks.com\/javascript\/rendering-restful-service-react\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.webcodegeeks.com\/javascript\/rendering-restful-service-react\/#primaryimage","url":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/js-logo.jpg","contentUrl":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/js-logo.jpg","width":150,"height":150},{"@type":"BreadcrumbList","@id":"https:\/\/www.webcodegeeks.com\/javascript\/rendering-restful-service-react\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.webcodegeeks.com\/"},{"@type":"ListItem","position":2,"name":"JavaScript","item":"https:\/\/www.webcodegeeks.com\/category\/javascript\/"},{"@type":"ListItem","position":3,"name":"Rendering RESTful service with React"}]},{"@type":"WebSite","@id":"https:\/\/www.webcodegeeks.com\/#website","url":"https:\/\/www.webcodegeeks.com\/","name":"Web Code Geeks","description":"Web Developers Resource Center","publisher":{"@id":"https:\/\/www.webcodegeeks.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.webcodegeeks.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.webcodegeeks.com\/#organization","name":"Exelixis Media P.C.","url":"https:\/\/www.webcodegeeks.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.webcodegeeks.com\/#\/schema\/logo\/image\/","url":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","contentUrl":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","width":864,"height":246,"caption":"Exelixis Media P.C."},"image":{"@id":"https:\/\/www.webcodegeeks.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/webcodegeeks","https:\/\/x.com\/webcodegeeks"]},{"@type":"Person","@id":"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/fc489af29df9e3ed4ebaa454247c4b12","name":"Arpit Aggarwal","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/a0dc71e538e67766feb7c436ea43f02757eeb1f9446613ae680752be7239a3f6?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/a0dc71e538e67766feb7c436ea43f02757eeb1f9446613ae680752be7239a3f6?s=96&d=mm&r=g","caption":"Arpit Aggarwal"},"sameAs":["https:\/\/aggarwalarpit.wordpress.com\/"],"url":"https:\/\/www.webcodegeeks.com\/author\/arpit-aggarwal\/"}]}},"_links":{"self":[{"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/posts\/17075","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/users\/492"}],"replies":[{"embeddable":true,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/comments?post=17075"}],"version-history":[{"count":0,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/posts\/17075\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/media\/920"}],"wp:attachment":[{"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/media?parent=17075"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/categories?post=17075"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/tags?post=17075"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}