{"id":736,"date":"2021-08-29T11:01:31","date_gmt":"2021-08-29T10:01:31","guid":{"rendered":"https:\/\/codeflarelimited.com\/blog\/?p=736"},"modified":"2021-08-29T14:24:09","modified_gmt":"2021-08-29T13:24:09","slug":"working-with-react-router-in-react-js","status":"publish","type":"post","link":"https:\/\/codeflarelimited.com\/blog\/working-with-react-router-in-react-js\/","title":{"rendered":"Working With React Router in React JS"},"content":{"rendered":"\n<p>Routing and navigation are inevitable in most software applications<\/p>\n\n\n\n<p>The way you would handle routing and navigation in <a href=\"https:\/\/codeflarelimited.com\/blog\/react-js-show-and-hide-loading-animation-on-button-click\/\" target=\"_blank\" rel=\"noreferrer noopener\">React JS<\/a> is somewhat different from the way you would, let&#8217;s say, in traditional HTML.<\/p>\n\n\n\n<p>In this tutorial we shall see how to work with React Router in React JS<\/p>\n\n\n\n<p>So let&#8217;s get straight to the point, shall we.<\/p>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-1-first-you-want-to-create-your-react-project\">1. First, you want to create your React project:<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"jsx\" class=\"language-jsx\">npx create-react-app yourFolderName<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-2-then-add-the-react-router-dependency\">2. Then add the React Router dependency<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"jsx\" class=\"language-jsx\">yarn add react-router-dom\n\n        or \n\nnpm install react-router-dom<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-3-next-start-the-app\">3. Next, start the app<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"jsx\" class=\"language-jsx\">yarn start<\/code><\/pre>\n\n\n\n<p>Let&#8217;s just design a simple nabber for our application. In your App.js (any other convenient file of your choice) add the following:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"jsx\" class=\"language-jsx\"> &lt;ul className=\"nav-link-style\"&gt;\n &lt;li&gt;Home&lt;\/li&gt;\n &lt;li&gt;About&lt;\/li&gt;\n &lt;li&gt;Contact&lt;\/li&gt;\n &lt;li&gt;Services&lt;\/li&gt;\n &lt;\/ul&gt;<\/code><\/pre>\n\n\n\n<p>Let&#8217;s add a bit of styling our App.css<\/p>\n\n\n\n<pre title=\"App.css\" class=\"wp-block-code\"><code lang=\"jsx\" class=\"language-jsx\"> .nav-link-style {\n   display: flex;\n   flex-direction: row;\n   justify-content: space-evenly;\n   align-items: center;\n   list-style: none;\n }<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-here-s-our-output-for-now\">Here&#8217;s our output for now:<\/h2>\n\n\n\n<p><\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"126\" src=\"https:\/\/codeflarelimited.com\/blog\/wp-content\/uploads\/2021\/08\/Screenshot-2021-08-28-at-05.50.50-1024x126.png\" alt=\"\" class=\"wp-image-738\" srcset=\"https:\/\/codeflarelimited.com\/blog\/wp-content\/uploads\/2021\/08\/Screenshot-2021-08-28-at-05.50.50-1024x126.png 1024w, https:\/\/codeflarelimited.com\/blog\/wp-content\/uploads\/2021\/08\/Screenshot-2021-08-28-at-05.50.50-300x37.png 300w, https:\/\/codeflarelimited.com\/blog\/wp-content\/uploads\/2021\/08\/Screenshot-2021-08-28-at-05.50.50-768x94.png 768w, https:\/\/codeflarelimited.com\/blog\/wp-content\/uploads\/2021\/08\/Screenshot-2021-08-28-at-05.50.50.png 1440w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><figcaption>React JS Routing and Navigation<\/figcaption><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-next-let-s-add-the-routing-logic\">Next, let&#8217;s add the Routing Logic<\/h2>\n\n\n\n<p>We will create a separate file and call it RouteFile (or whatever you decide to call yours, but it must not be Route or Router). This will handle our React Router We will add the following code to our RouteFile.js<\/p>\n\n\n\n<pre title=\"RouteFile.js\" class=\"wp-block-code\"><code lang=\"jsx\" class=\"language-jsx\">import React from 'react';\nimport {BrowserRouter as Router, Switch, Route} from 'react-router-dom';\nimport App from '..\/App';\n\n\nfunction RouteFile(){\n    return(\n        &lt;Router&gt;\n            &lt;Switch&gt;\n                &lt;Route exact path=\"\/\" component={App} \/&gt;\n            &lt;\/Switch&gt;\n        &lt;\/Router&gt;\n    )\n}\n\nexport default RouteFile;<\/code><\/pre>\n\n\n\n<p><\/p>\n\n\n\n<p>So, here&#8217;s our routing file and we only have one Route (or navigation) here. Notice we have the word &#8220;exact&#8221; and for path we have the &#8220;\/&#8221; and our component App.js. This means the App.js file is our landing page. When anyone visits our our website for the first time, they will land on the App.js file. <\/p>\n\n\n\n<p>This is similar to our default index file in html.<\/p>\n\n\n\n<p>What we want to do next is to create file components for other screens and link them accordingly.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-here-s-what-our-routing-file-looks-like\">Here&#8217;s what our Routing File looks like<\/h2>\n\n\n\n<pre title=\"RouteFile.js\" class=\"wp-block-code\"><code lang=\"jsx\" class=\"language-jsx\">import React from 'react';\nimport {BrowserRouter as Router, Switch, Route} from 'react-router-dom';\nimport About from '..\/About';\nimport App from '..\/App';\nimport Contact from '..\/Contact';\nimport Services from '..\/Services';\n\n\nfunction RouteFile(){\n    return(\n        &lt;Router&gt;\n            &lt;Switch&gt;\n                &lt;Route exact path=\"\/\" component={App} \/&gt;\n                &lt;Route  path=\"\/about\" component={About} \/&gt;\n                &lt;Route  path=\"\/contact\" component={Contact} \/&gt;\n                &lt;Route  path=\"\/services\" component={Services} \/&gt;\n            &lt;\/Switch&gt;\n        &lt;\/Router&gt;\n    )\n}\n\nexport default RouteFile;<\/code><\/pre>\n\n\n\n<p><\/p>\n\n\n\n<p>One advantage of Routing in React JS is that we able to customise our url to something short, simple and unique. <\/p>\n\n\n\n<p>So, here&#8217;s the full code for our App.js file<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"jsx\" class=\"language-jsx\">import React, { Component } from \"react\";\nimport \".\/App.css\";\nimport { Link } from \"react-router-dom\";\n\nclass App extends Component {\n \n  render() {\n    return (\n      &lt;div&gt;\n        &lt;ul className=\"nav-link-style\"&gt;\n          &lt;li&gt;&lt;Link to=\"\/\"&gt;Home&lt;\/Link&gt;&lt;\/li&gt;\n          &lt;li&gt;&lt;Link to=\"\/about\"&gt;About&lt;\/Link&gt;&lt;\/li&gt;\n          &lt;li&gt;&lt;Link to=\"\/contact\"&gt;Contact&lt;\/Link&gt;&lt;\/li&gt;\n          &lt;li&gt;&lt;Link to=\"\/services\"&gt;Services&lt;\/Link&gt;&lt;\/li&gt;\n        &lt;\/ul&gt;\n      &lt;\/div&gt;\n    );\n  }\n}\n\nexport default App;\n<\/code><\/pre>\n\n\n\n<p><\/p>\n\n\n\n<p>Finally, to make our Routing take effect, we need to set our RouteFile.js as the default starting component in our index.js file. Usually, the default component is App.js. But will replace that as follows:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"jsx\" class=\"language-jsx\">import React from 'react';\nimport ReactDOM from 'react-dom';\nimport '.\/index.css';\nimport App from '.\/App';\nimport reportWebVitals from '.\/reportWebVitals';\nimport RouteFile from '.\/Routes\/RouteFile';\n\nReactDOM.render(\n  &lt;React.StrictMode&gt;\n    &lt;RouteFile \/&gt; \n  &lt;\/React.StrictMode&gt;,\n  document.getElementById('root')\n);\n\n\/\/ If you want to start measuring performance in your app, pass a function\n\/\/ to log results (for example: reportWebVitals(console.log))\n\/\/ or send to an analytics endpoint. Learn more: https:\/\/bit.ly\/CRA-vitals\nreportWebVitals();\n<\/code><\/pre>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-here-s-how-it-works-now\">Here&#8217;s how it works now:<\/h2>\n\n\n\n<figure class=\"wp-block-video\"><video height=\"900\" style=\"aspect-ratio: 1440 \/ 900;\" width=\"1440\" controls src=\"https:\/\/codeflarelimited.com\/blog\/wp-content\/uploads\/2021\/08\/Routing.mp4\"><\/video><figcaption>Routing in React Js<\/figcaption><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-congratulations\">Congratulations!<\/h2>\n\n\n\n<p>You have successfully added React Router to your React application.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-see-also\">See also<\/h3>\n\n\n\n<p><a href=\"https:\/\/play.google.com\/store\/apps\/details?id=com.codeflare\" target=\"_blank\" rel=\"noreferrer noopener\">Mobile app template for mobile app developers<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Routing and navigation are inevitable in most software applications The way you would handle routing and navigation in<\/p>\n","protected":false},"author":1,"featured_media":741,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[73,98],"tags":[],"class_list":["post-736","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-react-js","category-softare-development"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Working With React Router in React JS<\/title>\n<meta name=\"description\" content=\"In this tutorial we shall see how to work with React Router in React JS. React Router is the go-to method for Navigation in React JS\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/codeflarelimited.com\/blog\/working-with-react-router-in-react-js\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Working With React Router in React JS\" \/>\n<meta property=\"og:description\" content=\"In this tutorial we shall see how to work with React Router in React JS. React Router is the go-to method for Navigation in React JS\" \/>\n<meta property=\"og:url\" content=\"https:\/\/codeflarelimited.com\/blog\/working-with-react-router-in-react-js\/\" \/>\n<meta property=\"article:author\" content=\"https:\/\/facebook.com\/codeflretech\" \/>\n<meta property=\"article:published_time\" content=\"2021-08-29T10:01:31+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-08-29T13:24:09+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/codeflarelimited.com\/blog\/wp-content\/uploads\/2021\/08\/Screenshot-2021-08-28-at-10.44.16.png\" \/>\n\t<meta property=\"og:image:width\" content=\"935\" \/>\n\t<meta property=\"og:image:height\" content=\"468\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"codeflare\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@codeflaretech\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"TechArticle\",\"@id\":\"https:\\\/\\\/codeflarelimited.com\\\/blog\\\/working-with-react-router-in-react-js\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/codeflarelimited.com\\\/blog\\\/working-with-react-router-in-react-js\\\/\"},\"author\":{\"name\":\"codeflare\",\"@id\":\"https:\\\/\\\/codeflarelimited.com\\\/blog\\\/#\\\/schema\\\/person\\\/7e65653d49add95629f8c1053c5cd76a\"},\"headline\":\"Working With React Router in React JS\",\"datePublished\":\"2021-08-29T10:01:31+00:00\",\"dateModified\":\"2021-08-29T13:24:09+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/codeflarelimited.com\\\/blog\\\/working-with-react-router-in-react-js\\\/\"},\"wordCount\":362,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/codeflarelimited.com\\\/blog\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/codeflarelimited.com\\\/blog\\\/working-with-react-router-in-react-js\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/codeflarelimited.com\\\/blog\\\/wp-content\\\/uploads\\\/2021\\\/08\\\/Screenshot-2021-08-28-at-10.44.16.png\",\"articleSection\":[\"react js\",\"softare development\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/codeflarelimited.com\\\/blog\\\/working-with-react-router-in-react-js\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/codeflarelimited.com\\\/blog\\\/working-with-react-router-in-react-js\\\/\",\"url\":\"https:\\\/\\\/codeflarelimited.com\\\/blog\\\/working-with-react-router-in-react-js\\\/\",\"name\":\"Working With React Router in React JS\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/codeflarelimited.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/codeflarelimited.com\\\/blog\\\/working-with-react-router-in-react-js\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/codeflarelimited.com\\\/blog\\\/working-with-react-router-in-react-js\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/codeflarelimited.com\\\/blog\\\/wp-content\\\/uploads\\\/2021\\\/08\\\/Screenshot-2021-08-28-at-10.44.16.png\",\"datePublished\":\"2021-08-29T10:01:31+00:00\",\"dateModified\":\"2021-08-29T13:24:09+00:00\",\"description\":\"In this tutorial we shall see how to work with React Router in React JS. React Router is the go-to method for Navigation in React JS\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/codeflarelimited.com\\\/blog\\\/working-with-react-router-in-react-js\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/codeflarelimited.com\\\/blog\\\/working-with-react-router-in-react-js\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/codeflarelimited.com\\\/blog\\\/working-with-react-router-in-react-js\\\/#primaryimage\",\"url\":\"https:\\\/\\\/codeflarelimited.com\\\/blog\\\/wp-content\\\/uploads\\\/2021\\\/08\\\/Screenshot-2021-08-28-at-10.44.16.png\",\"contentUrl\":\"https:\\\/\\\/codeflarelimited.com\\\/blog\\\/wp-content\\\/uploads\\\/2021\\\/08\\\/Screenshot-2021-08-28-at-10.44.16.png\",\"width\":935,\"height\":468,\"caption\":\"React Router in React JS\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/codeflarelimited.com\\\/blog\\\/working-with-react-router-in-react-js\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/codeflarelimited.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"softare development\",\"item\":\"https:\\\/\\\/codeflarelimited.com\\\/blog\\\/softare-development\\\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Working With React Router in React JS\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/codeflarelimited.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/codeflarelimited.com\\\/blog\\\/\",\"name\":\"\",\"description\":\"Sustainable solutions\",\"publisher\":{\"@id\":\"https:\\\/\\\/codeflarelimited.com\\\/blog\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/codeflarelimited.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/codeflarelimited.com\\\/blog\\\/#organization\",\"name\":\"Codeflare Limited\",\"url\":\"https:\\\/\\\/codeflarelimited.com\\\/blog\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/codeflarelimited.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/codeflarelimited.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/11\\\/codeflare.png\",\"contentUrl\":\"https:\\\/\\\/codeflarelimited.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/11\\\/codeflare.png\",\"width\":1040,\"height\":263,\"caption\":\"Codeflare Limited\"},\"image\":{\"@id\":\"https:\\\/\\\/codeflarelimited.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/codeflarelimited.com\\\/blog\\\/#\\\/schema\\\/person\\\/7e65653d49add95629f8c1053c5cd76a\",\"name\":\"codeflare\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/59cef917c86d965eea581d2747f51bd6382003a68bfce7c8a4dfec98b4cd838d?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/59cef917c86d965eea581d2747f51bd6382003a68bfce7c8a4dfec98b4cd838d?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/59cef917c86d965eea581d2747f51bd6382003a68bfce7c8a4dfec98b4cd838d?s=96&d=mm&r=g\",\"caption\":\"codeflare\"},\"description\":\"Latest tech news and coding tips.\",\"sameAs\":[\"https:\\\/\\\/codeflarelimited.com\\\/blog\",\"https:\\\/\\\/facebook.com\\\/codeflretech\",\"https:\\\/\\\/instagram.com\\\/codeflaretech\",\"https:\\\/\\\/x.com\\\/codeflaretech\",\"https:\\\/\\\/www.youtube.com\\\/channel\\\/UCuBLtiYqsajHdqw0uyt7Ofw?sub_confirmation=1\"],\"url\":\"https:\\\/\\\/codeflarelimited.com\\\/blog\\\/author\\\/watcher\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Working With React Router in React JS","description":"In this tutorial we shall see how to work with React Router in React JS. React Router is the go-to method for Navigation in React JS","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:\/\/codeflarelimited.com\/blog\/working-with-react-router-in-react-js\/","og_locale":"en_US","og_type":"article","og_title":"Working With React Router in React JS","og_description":"In this tutorial we shall see how to work with React Router in React JS. React Router is the go-to method for Navigation in React JS","og_url":"https:\/\/codeflarelimited.com\/blog\/working-with-react-router-in-react-js\/","article_author":"https:\/\/facebook.com\/codeflretech","article_published_time":"2021-08-29T10:01:31+00:00","article_modified_time":"2021-08-29T13:24:09+00:00","og_image":[{"width":935,"height":468,"url":"https:\/\/codeflarelimited.com\/blog\/wp-content\/uploads\/2021\/08\/Screenshot-2021-08-28-at-10.44.16.png","type":"image\/png"}],"author":"codeflare","twitter_card":"summary_large_image","twitter_creator":"@codeflaretech","schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"TechArticle","@id":"https:\/\/codeflarelimited.com\/blog\/working-with-react-router-in-react-js\/#article","isPartOf":{"@id":"https:\/\/codeflarelimited.com\/blog\/working-with-react-router-in-react-js\/"},"author":{"name":"codeflare","@id":"https:\/\/codeflarelimited.com\/blog\/#\/schema\/person\/7e65653d49add95629f8c1053c5cd76a"},"headline":"Working With React Router in React JS","datePublished":"2021-08-29T10:01:31+00:00","dateModified":"2021-08-29T13:24:09+00:00","mainEntityOfPage":{"@id":"https:\/\/codeflarelimited.com\/blog\/working-with-react-router-in-react-js\/"},"wordCount":362,"commentCount":0,"publisher":{"@id":"https:\/\/codeflarelimited.com\/blog\/#organization"},"image":{"@id":"https:\/\/codeflarelimited.com\/blog\/working-with-react-router-in-react-js\/#primaryimage"},"thumbnailUrl":"https:\/\/codeflarelimited.com\/blog\/wp-content\/uploads\/2021\/08\/Screenshot-2021-08-28-at-10.44.16.png","articleSection":["react js","softare development"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/codeflarelimited.com\/blog\/working-with-react-router-in-react-js\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/codeflarelimited.com\/blog\/working-with-react-router-in-react-js\/","url":"https:\/\/codeflarelimited.com\/blog\/working-with-react-router-in-react-js\/","name":"Working With React Router in React JS","isPartOf":{"@id":"https:\/\/codeflarelimited.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/codeflarelimited.com\/blog\/working-with-react-router-in-react-js\/#primaryimage"},"image":{"@id":"https:\/\/codeflarelimited.com\/blog\/working-with-react-router-in-react-js\/#primaryimage"},"thumbnailUrl":"https:\/\/codeflarelimited.com\/blog\/wp-content\/uploads\/2021\/08\/Screenshot-2021-08-28-at-10.44.16.png","datePublished":"2021-08-29T10:01:31+00:00","dateModified":"2021-08-29T13:24:09+00:00","description":"In this tutorial we shall see how to work with React Router in React JS. React Router is the go-to method for Navigation in React JS","breadcrumb":{"@id":"https:\/\/codeflarelimited.com\/blog\/working-with-react-router-in-react-js\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/codeflarelimited.com\/blog\/working-with-react-router-in-react-js\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/codeflarelimited.com\/blog\/working-with-react-router-in-react-js\/#primaryimage","url":"https:\/\/codeflarelimited.com\/blog\/wp-content\/uploads\/2021\/08\/Screenshot-2021-08-28-at-10.44.16.png","contentUrl":"https:\/\/codeflarelimited.com\/blog\/wp-content\/uploads\/2021\/08\/Screenshot-2021-08-28-at-10.44.16.png","width":935,"height":468,"caption":"React Router in React JS"},{"@type":"BreadcrumbList","@id":"https:\/\/codeflarelimited.com\/blog\/working-with-react-router-in-react-js\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/codeflarelimited.com\/blog\/"},{"@type":"ListItem","position":2,"name":"softare development","item":"https:\/\/codeflarelimited.com\/blog\/softare-development\/"},{"@type":"ListItem","position":3,"name":"Working With React Router in React JS"}]},{"@type":"WebSite","@id":"https:\/\/codeflarelimited.com\/blog\/#website","url":"https:\/\/codeflarelimited.com\/blog\/","name":"","description":"Sustainable solutions","publisher":{"@id":"https:\/\/codeflarelimited.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/codeflarelimited.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/codeflarelimited.com\/blog\/#organization","name":"Codeflare Limited","url":"https:\/\/codeflarelimited.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/codeflarelimited.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/codeflarelimited.com\/blog\/wp-content\/uploads\/2020\/11\/codeflare.png","contentUrl":"https:\/\/codeflarelimited.com\/blog\/wp-content\/uploads\/2020\/11\/codeflare.png","width":1040,"height":263,"caption":"Codeflare Limited"},"image":{"@id":"https:\/\/codeflarelimited.com\/blog\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/codeflarelimited.com\/blog\/#\/schema\/person\/7e65653d49add95629f8c1053c5cd76a","name":"codeflare","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/59cef917c86d965eea581d2747f51bd6382003a68bfce7c8a4dfec98b4cd838d?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/59cef917c86d965eea581d2747f51bd6382003a68bfce7c8a4dfec98b4cd838d?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/59cef917c86d965eea581d2747f51bd6382003a68bfce7c8a4dfec98b4cd838d?s=96&d=mm&r=g","caption":"codeflare"},"description":"Latest tech news and coding tips.","sameAs":["https:\/\/codeflarelimited.com\/blog","https:\/\/facebook.com\/codeflretech","https:\/\/instagram.com\/codeflaretech","https:\/\/x.com\/codeflaretech","https:\/\/www.youtube.com\/channel\/UCuBLtiYqsajHdqw0uyt7Ofw?sub_confirmation=1"],"url":"https:\/\/codeflarelimited.com\/blog\/author\/watcher\/"}]}},"jetpack_featured_media_url":"https:\/\/codeflarelimited.com\/blog\/wp-content\/uploads\/2021\/08\/Screenshot-2021-08-28-at-10.44.16.png","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/codeflarelimited.com\/blog\/wp-json\/wp\/v2\/posts\/736","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/codeflarelimited.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/codeflarelimited.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/codeflarelimited.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/codeflarelimited.com\/blog\/wp-json\/wp\/v2\/comments?post=736"}],"version-history":[{"count":5,"href":"https:\/\/codeflarelimited.com\/blog\/wp-json\/wp\/v2\/posts\/736\/revisions"}],"predecessor-version":[{"id":745,"href":"https:\/\/codeflarelimited.com\/blog\/wp-json\/wp\/v2\/posts\/736\/revisions\/745"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/codeflarelimited.com\/blog\/wp-json\/wp\/v2\/media\/741"}],"wp:attachment":[{"href":"https:\/\/codeflarelimited.com\/blog\/wp-json\/wp\/v2\/media?parent=736"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/codeflarelimited.com\/blog\/wp-json\/wp\/v2\/categories?post=736"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/codeflarelimited.com\/blog\/wp-json\/wp\/v2\/tags?post=736"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}