<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Antonio Goeminne</title>
    <description>The latest articles on DEV Community by Antonio Goeminne (@antonio_goeminne).</description>
    <link>https://dev.to/antonio_goeminne</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F671017%2F2957edec-616b-4f82-bba2-d5ba202324b1.jpeg</url>
      <title>DEV Community: Antonio Goeminne</title>
      <link>https://dev.to/antonio_goeminne</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/antonio_goeminne"/>
    <language>en</language>
    <item>
      <title>👨‍🔧Deploy your React app on GitHub. [fixing routes problems]🔥</title>
      <dc:creator>Antonio Goeminne</dc:creator>
      <pubDate>Wed, 11 Aug 2021 20:42:57 +0000</pubDate>
      <link>https://dev.to/antonio_goeminne/deploy-your-react-app-on-github-fixing-routes-problems-3d45</link>
      <guid>https://dev.to/antonio_goeminne/deploy-your-react-app-on-github-fixing-routes-problems-3d45</guid>
      <description>&lt;h2&gt;
  
  
  Before we start.
&lt;/h2&gt;

&lt;p&gt;I will be direct, there are a lot of information of how to deploy a react app on github using the gh-pages dependency, so i am going to give quickly instruccions of that. i will explain better the part that allows you to not have problems with routes.&lt;/p&gt;

&lt;h2&gt;
  
  
  Intro
&lt;/h2&gt;

&lt;p&gt;I needed do this post because of when i had this problem i didn't find any solution, every post were about deploying an app in the begining but no one fixed my problem with Routes. &lt;br&gt;
In react you can use(you should have to) react-router-dom. It's a dependency that allows you configure a router to have in your development. I found myself creating a react app with more than five routes when i decided to deploy this on github and this was the result:&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffclllmibspfdx9apsob6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffclllmibspfdx9apsob6.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;br&gt;
Nothing happened, the web was in white for a long time. &lt;/p&gt;

&lt;h2&gt;
  
  
  what do you have to do?
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;install gh -pages in the folder where is the repository.&lt;/li&gt;
&lt;li&gt;make sure you got node .js , npm and react-router-dom in the last versions.&lt;/li&gt;
&lt;li&gt;&lt;p&gt;After having your repositorie commited you have to go the node dependencys in the top and write&lt;br&gt;
&lt;br&gt;
&lt;code&gt;"homepage": "https//*yourname*.github.io/*deployname*"&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;in the same archive go to the "script" and at the beginning write&lt;br&gt;
&lt;br&gt;
&lt;code&gt;pre-build:"npm run build" and build:"gh-pages -d build"&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;At this point just left one more command to deploy your app but that doesn`t fix the route problem.&lt;/p&gt;

&lt;h2&gt;
  
  
  the route problem
&lt;/h2&gt;

&lt;p&gt;When you deploy your app on github you got to put your homepage with the deploy name, and this generate the white page that doesn`t load. So you have to make sure that your home route to the same name of your app. &lt;br&gt;
Tip: like your app is not finding the route '/' it will show you a 404 error page, so it is a good note to configure your 404 error page. In react-router-dom you can do it quickly whit this route'*'.&lt;/p&gt;

&lt;h2&gt;
  
  
  let`s finish this
&lt;/h2&gt;

&lt;p&gt;After do all , go to the folder repository and write &lt;br&gt;
&lt;code&gt;&lt;/code&gt;&lt;code&gt;npm run deploy&lt;/code&gt;&lt;code&gt;&lt;/code&gt;&lt;br&gt;
and that`s all. you have to wait some minutes to this works.&lt;/p&gt;

&lt;h3&gt;
  
  
  if this doesn`t work
&lt;/h3&gt;

&lt;p&gt;it could happen this does not work you, because in one of my deploys i had to add an extra pass that at these days i dont` know why i had to did it. &lt;br&gt;
After you write npx bla bla and create your react app it comes with default folders and files, one of them are App.&lt;br&gt;
For some reason i had to put the routes on this file (App.jsx) and after that it worked. &lt;/p&gt;

&lt;h4&gt;
  
  
  i hope this could help someone, if you have some question don`t doubt to make it.
&lt;/h4&gt;

</description>
      <category>react</category>
      <category>github</category>
      <category>deploy</category>
      <category>firstpost</category>
    </item>
  </channel>
</rss>
