<?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: Skyler Dowdy</title>
    <description>The latest articles on DEV Community by Skyler Dowdy (@skylerwebdev).</description>
    <link>https://dev.to/skylerwebdev</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%2F224435%2F25540429-e679-407c-af63-6b6c75f6c76b.png</url>
      <title>DEV Community: Skyler Dowdy</title>
      <link>https://dev.to/skylerwebdev</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/skylerwebdev"/>
    <language>en</language>
    <item>
      <title>2020 Bash Scripts for React</title>
      <dc:creator>Skyler Dowdy</dc:creator>
      <pubDate>Fri, 28 Feb 2020 15:08:00 +0000</pubDate>
      <link>https://dev.to/skylerwebdev/2020-bash-scripts-for-react-15ff</link>
      <guid>https://dev.to/skylerwebdev/2020-bash-scripts-for-react-15ff</guid>
      <description>&lt;h4&gt;
  
  
  I wrote a few BASH scripts to help in the Git and React World
&lt;/h4&gt;

&lt;h4&gt;
  
  
  All instructions are in the README
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://github.com/skylerwebdev/bash"&gt;Bash Scripts&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  File 1 - Bash Aliases - to make your life easier...
&lt;/h4&gt;

&lt;h2&gt;
  
  
  Script 1 - setup-react.sh
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Asks for an app name and creates it in the current folder&lt;/li&gt;
&lt;li&gt;Installs react-router and react-router-dom&lt;/li&gt;
&lt;li&gt;Creates a file / folder structure:

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;configs/AppRouter.jsx&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;configs/PrivateRoute.jsx&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;components/reuse/NavBar.jsx&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;components/pages/Header.jsx&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;components/pages/Footer.jsx&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;pages/user/Home.jsx&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;pages/user/Contact.jsx&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;pages/user/About.jsx&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Writes the Routes for the pages and puts content into each of them&lt;/li&gt;
&lt;li&gt;Rewrites the App.js file to contain:

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;&amp;lt;Header /&amp;gt;&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;&amp;lt;AppRouter /&amp;gt;&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;&amp;lt;Footer /&amp;gt;&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Rewrites index.js to wrap the App component in BrowserRouter&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Script 2 - Git Create Branch
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Asks for branch name&lt;/li&gt;
&lt;li&gt;Creates a new branch&lt;/li&gt;
&lt;li&gt;Sets the upstream for the branch&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Script 3 -- Git Deploy
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Asks for a Commit message&lt;/li&gt;
&lt;li&gt;Adds files&lt;/li&gt;
&lt;li&gt;Commits files with commit message&lt;/li&gt;
&lt;li&gt;Pushes files to current branch as long as the upstream is set&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Script 4 - Clean Node Modules
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Digs down deep to remove node modules folders&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>react</category>
      <category>bash</category>
      <category>startup</category>
      <category>shell</category>
    </item>
    <item>
      <title>2020 Setting up a Private Route in React</title>
      <dc:creator>Skyler Dowdy</dc:creator>
      <pubDate>Wed, 26 Feb 2020 18:49:59 +0000</pubDate>
      <link>https://dev.to/skylerwebdev/setting-up-a-private-route-in-react-3ph0</link>
      <guid>https://dev.to/skylerwebdev/setting-up-a-private-route-in-react-3ph0</guid>
      <description>&lt;p&gt;&lt;a href="https://dev.to/skyler2440/2020-setting-up-react-navigation-with-git-1ac8"&gt;This tutorial follows Tutorial 1&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Provided you are using react-router-dom the code should still work for you. I will be linking the github repo ASAP&lt;/p&gt;

&lt;h1&gt;
  
  
  Step1
&lt;/h1&gt;

&lt;h2&gt;
  
  
  Setup files needed for tutorial.
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Open your Project in VsCode
a. &lt;code&gt;cd projects/yourprojectnamehere&lt;/code&gt;
b. &lt;code&gt;code .&lt;/code&gt;
c. or Just use the file menu&lt;/li&gt;
&lt;li&gt;Open the VS Code Terminal and Get the status of git.
a. &lt;code&gt;git status&lt;/code&gt; 
    1. You should be on the master branch and your working tree should be clean&lt;/li&gt;
&lt;li&gt;Checkout to a new branch and set the upstream
a. &lt;code&gt;git checkout -b &amp;lt;Tutorial-2-PrivateRoute&amp;gt;&lt;/code&gt;
b. &lt;code&gt;git push -u origin &amp;lt;Tutorial-2-PrivateRoute&amp;gt;&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Create a PrivateRoute file
a. &lt;code&gt;touch src/cofigs/PrivateRoute.jsx&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Create a private file
a. &lt;code&gt;touch pages/admin/AdminHome.jsx&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Add some content to the AdminHome file
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import React from 'react'

const AdminHome = () =&amp;gt; {
return (
&amp;lt;div&amp;gt;
&amp;lt;h1&amp;gt;Welcome home Admin&amp;lt;/h1&amp;gt;
&amp;lt;/div&amp;gt;
)
}

export default AdminHome
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h1&gt;
  
  
  Step 2
&lt;/h1&gt;

&lt;h2&gt;
  
  
  Creating the Private Route File.
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Import React, Route and Redirect
a. &lt;code&gt;imr&lt;/code&gt;
b. &lt;code&gt;imd&lt;/code&gt;
c. &lt;code&gt;import { Route as R, Redirect as RD } from 'react-router-dom';&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Setup the arrow fucntion&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Note: We are not using |rafce| here because we are bringing in props. (More to be explained later)&lt;/p&gt;

&lt;p&gt;a.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const PrivateRoute = ({ component: Component, ...rest }) = {

   &amp;lt;R
{...rest}
render={props =&amp;gt;
  localStorage.getItem('token') ?
(
&amp;lt;Component {...props} /&amp;gt;
):
(
&amp;lt;RD to='/' /&amp;gt;
)
  }
[/](file:///)&amp;gt;
   );
  export default PrivateRoute;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h2&gt;
  
  
  Lets Break this down:
&lt;/h2&gt;

&lt;p&gt;Components - let you split and isolate the UI into independent, reuseable pieces they are like JS functions&lt;br&gt;
Props - the inputs that components accept&lt;br&gt;
Render - Display&lt;br&gt;
Ternary - If Else Statement&lt;br&gt;
localStorage - a place where you can store data on a users machine to be used by the site&lt;br&gt;
... - Spread operator - expands a string, object, or array into it's elements&lt;/p&gt;

&lt;h2&gt;
  
  
  What are we doing?
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;We are bringing the component property defined on props from our AppRouter file (we will hook this up in a minute) and assinging it to a new location in state called Component.&lt;/li&gt;
&lt;li&gt;We are then taking any remaining objects defined on props and collecting them in an argument called ...rest&lt;/li&gt;
&lt;li&gt;After this we are setting up a route to render our props to our private componenet IF there is a token in localStorage otherwise, we are redirecting to home.&lt;/li&gt;
&lt;/ol&gt;

&lt;h1&gt;
  
  
  Step 3
&lt;/h1&gt;

&lt;h2&gt;
  
  
  Setting up the AppRouter file to render the PrivateRoute
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Open the AppRouter.jsx file and import PrivateRoute
a. &lt;code&gt;import PrivateRoute from './PrivateRoute.jsx';&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Import the AdminHome Page
a. &lt;code&gt;import AdminHome from '../pages/admin/AdminHome.jsx';&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Add a Private Route to the AdminHome Page
a. &lt;code&gt;&amp;lt;PrivateRoute path='/admin/AdminHome' componenet={AdminHome} /&amp;gt;&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Add a NavLink to the AdminHome page
a. open the NavBar.jsx file
b. &lt;code&gt;&amp;lt;NL to='/admin/adminhome/'&amp;gt;Admin Home&amp;lt;NL/&amp;gt;&lt;/code&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;h1&gt;
  
  
  Step 4
&lt;/h1&gt;

&lt;h2&gt;
  
  
  Tying it all together
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Run your app
a. &lt;code&gt;npm start&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Open your developer tools (Chrome) Firefox works too
a. right click on the page
b. click inspect&lt;/li&gt;
&lt;li&gt;Clear Tokens from localStorage if any
a. In the top of the developer tool click Application
b. To the right click Local Storage
c. Open the local storage for the page you are on
d. if there is a token delete it (click and press the x)&lt;/li&gt;
&lt;li&gt;Try to navigate to AdminHome
a. It should not work and redirect you to Home&lt;/li&gt;
&lt;li&gt;Add a token
a. In the place where we checked for tokens double click the key field and type token (be sure this matches what you are calling from local storage)
b. Give your token any value&lt;/li&gt;
&lt;li&gt;Navigate to your Admin Home&lt;/li&gt;
&lt;li&gt;Add, Commit, Push, and Pull Request your new private route&lt;/li&gt;
&lt;/ol&gt;

</description>
      <category>react</category>
      <category>privateroute</category>
    </item>
    <item>
      <title>2020 Setting up React Navigation in a new git repo</title>
      <dc:creator>Skyler Dowdy</dc:creator>
      <pubDate>Wed, 26 Feb 2020 18:40:29 +0000</pubDate>
      <link>https://dev.to/skylerwebdev/2020-setting-up-react-navigation-with-git-1ac8</link>
      <guid>https://dev.to/skylerwebdev/2020-setting-up-react-navigation-with-git-1ac8</guid>
      <description>&lt;h1&gt;
  
  
  Prerequisites
&lt;/h1&gt;

&lt;h2&gt;
  
  
  System Requirements:
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Computer Running Linux Debian / Ubuntu (Preferred), Windows 7 or Later, MacOS X or Later&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Programs Requirements:
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Node.js along with NPM/NPX and Chocolatey&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;More information can be found at &lt;a href="https://nodejs.org"&gt;https://nodejs.org&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;A Text Editor VS Code or Atom Preferred  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;I am going to be using VS Code and utilizing the Shortcuts for VS code&lt;/li&gt;
&lt;li&gt;You Can use anything from Acme to Zile (I have no Idea what either of these text editors are)&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;If using VSCode these are the plugins I will be using you can also find them for Atom as well&lt;br&gt;
a. &lt;a href="https://marketplace.visualstudio.com/items?itemName=dsznajder.es7-react-js-snippets"&gt;ES7 React/Redux/GraphQL/React-Native snippets&lt;/a&gt;&lt;br&gt;
b. &lt;a href="https://github.com/prettier/prettier-vscode"&gt;Prettier - Code Formatter&lt;/a&gt;&lt;br&gt;
c. &lt;a href="https://marketplace.visualstudio.com/items?itemName=ChakrounAnas.turbo-console-log"&gt;Turbo Console Log&lt;/a&gt;&lt;br&gt;
d. I use &lt;a href="https://github.com/tonsky/FiraCode/wiki/VS-Code-Instructions"&gt;FiraCode&lt;/a&gt; font with ligatures enabled (that is how the =&amp;gt; sign connects itself)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Terminal Access (&lt;a href="https://git-scm.com/downloads"&gt;GitBash&lt;/a&gt; if you are using Windows)&lt;br&gt;
a. When installing be sure to select the correct text editor DO NOT SELECT VIM UNLESS YOU KNOW WHAT YOU ARE DOING!&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Basic Knowledge of HTML, CSS, and JavaScript&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://github.com"&gt;Github&lt;/a&gt; Account connected either Https or SSL&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h1&gt;
  
  
  MY RANT:
&lt;/h1&gt;

&lt;p&gt;Linux Debian or Ubuntu with the Budgie or Mate desktop is what I reccommend that all programmers use. Unless, you are developing strictly for Apple products. Why? Speed, Performance, OpenSource, lack of bloatware... I could go on forever. It is however a personal preference and it does take some learning but, once you are used to it you will never want to use Windows Again... I have a PC with Windows on it and I rarely even turn it on because the only thing I cannot do on my Linux machine that I can on my Windows is play certain games... If you plan on developing for Apple products (swift) then a Mac is 100% the way to go. WINDOWS IS &lt;strong&gt;NEVER&lt;/strong&gt; THE WAY TO GO&lt;/p&gt;

&lt;h1&gt;
  
  
  Step 1
&lt;/h1&gt;

&lt;h3&gt;
  
  
  Creating a Git Repo, Creating the React Application, and Pushing to the Repo.
&lt;/h3&gt;

&lt;h5&gt;
  
  
  This step just walks through the basics of creating a react application. If this does not work for you please make sure that you have checked all of the
&lt;/h5&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Create a new Git Repository ** NO README **&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Open a Terminal (GitBash if you are using windows)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Create the React App &lt;br&gt;
a. &lt;code&gt;npx create-react-app &amp;lt;react-tutorial-app&amp;gt;&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Change to the newly created directory &lt;br&gt;
a. &lt;code&gt;cd &amp;lt;react-tutorial-app&amp;gt;&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Paste in the commands from github&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Change to a new branch &lt;br&gt;
a. &lt;code&gt;git checkout -b &amp;lt;Tutorial1-Create-React-App-Nav&amp;gt;&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Install React Router&lt;br&gt;
a. &lt;code&gt;npm i react-router react-router-dom&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Start your React App&lt;br&gt;
a. &lt;code&gt;npm start&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;You should now see your React App running in your browser. If not open it and navigate to "&lt;a href="http://localhost:3000"&gt;localhost:3000&lt;/a&gt;"&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Navigate to your terminal and stop the application&lt;br&gt;
a. &lt;code&gt;ctrl + c&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h1&gt;
  
  
  Step 2
&lt;/h1&gt;

&lt;h3&gt;
  
  
  Creating a folder structure and adding some base files.
&lt;/h3&gt;

&lt;h4&gt;
  
  
  All good applications need organization. If your app is not organized when it gets larger it makes it very hard to find things so, we are going to go ahead and setup the file structure now. If we setup our file structure while the application is small it makes it easier to tweak if we need to as the application grows. There is no right or wrong way to organize your files and you can do it any way that you please. Once you find a way that you like you can write a BASH script that will do all of the work for you. The things you need for this tutorial are jsx files named Header Navbar Footer AppRouter Home and About you can create them any way you would like to.
&lt;/h4&gt;

&lt;p&gt;This is how I do it:&lt;/p&gt;

&lt;p&gt;Assuming you are coming from Step 1 and are in the root directory of your newly created app e.g. /home//&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Change into the "src" directory&lt;br&gt;
a. &lt;code&gt;cd src&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Create your folders&lt;br&gt;
a. &lt;code&gt;mkdir -p configs components/pages components/forms pages/user pages/admin sources/images sources/raw_images styles/components styles/pages styles/forms&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;The -p tells it to create the parent directory if it does not exist&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;I use components/for things like my Header, Footer, NavBar, forms, etc&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;I use pages to hold the main pages either user or admin&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;I use sources/images to hold all the images displayed on the site &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;I use sources/raw_images to hold all of the photoshop or gimp files&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;I use styles to hold all of the styling&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Create your files&lt;br&gt;
a. &lt;code&gt;cd configs&lt;/code&gt;&lt;br&gt;
b. &lt;code&gt;touch AppRouter.jsx&lt;/code&gt;&lt;br&gt;
c. &lt;code&gt;cd ../components/pages&lt;/code&gt;&lt;br&gt;
d. &lt;code&gt;touch Header.jsx Footer.jsx&lt;/code&gt;&lt;br&gt;
e. &lt;code&gt;cd [.]()./&lt;/code&gt;&lt;br&gt;
f. &lt;code&gt;touch NavBar.jsx&lt;/code&gt;&lt;br&gt;
g. &lt;code&gt;cd ../pages/user&lt;/code&gt;&lt;br&gt;
h. &lt;code&gt;touch Home.jsx About.jsx&lt;/code&gt;&lt;br&gt;
i. &lt;code&gt;cd ../../styles/pages&lt;/code&gt;&lt;br&gt;
j. &lt;code&gt;touch MainPage.css&lt;/code&gt;&lt;br&gt;
k. &lt;code&gt;cd ../components&lt;/code&gt;&lt;br&gt;
l. &lt;code&gt;touch NavBar.css&lt;/code&gt;&lt;br&gt;
m. &lt;code&gt;cd ../../../&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Add the changes to git&lt;br&gt;
a. &lt;code&gt;git add .&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Commit the changes&lt;br&gt;
a. &lt;code&gt;git commit&lt;/code&gt;&lt;br&gt;
b. enter a commit message&lt;br&gt;
c. &lt;code&gt;ctrl +x&lt;/code&gt;&lt;br&gt;
d. &lt;code&gt;y&lt;/code&gt;&lt;br&gt;
e. &lt;code&gt;enter&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Set the upstream and push the changes&lt;br&gt;
a. &lt;code&gt;git push -u origin Tutorial1-Create-React-App-Nav&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h1&gt;
  
  
  Step 3
&lt;/h1&gt;

&lt;h3&gt;
  
  
  Setting up the files
&lt;/h3&gt;

&lt;h5&gt;
  
  
  In this step we are just going through and creating empty arrow functions for all of our newly created files. Once you get a structure setup that you like you can also automate this with a script as well.
&lt;/h5&gt;

&lt;p&gt;This is where those VS code extensions will come in handy!&lt;/p&gt;

&lt;p&gt;Assuming you are coming from Step 2 and are in the root directory of your newly created app e.g. /home//&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Open your text editor of choice I am using VS Code (one of the few good things to come from Microsoft)&lt;br&gt;
a. &lt;code&gt;code .&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Open each one of the newly created files in your text editor&lt;br&gt;
a. |rafce| (Creates a react arrow function default exported)&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;It should produce something in each one of your files that looks like example 1 at the bottom of the file&lt;/li&gt;
&lt;li&gt;If |rafce| did not work:

&lt;ul&gt;
&lt;li&gt;Check that you have &lt;a href="https://marketplace.visualstudio.com/items?itemName=dsznajder.es7-react-js-snippets"&gt;ES7 React/Redux/GraphQL/React-Native snippets&lt;/a&gt; installed in vs code and restart VS Code&lt;/li&gt;
&lt;li&gt;Check that you named the file with the &lt;strong&gt;.jsx&lt;/strong&gt; extension&lt;/li&gt;
&lt;li&gt;Check that the Language Mode is "JavaScript React" in the bottom right hand corner of VS Code. &lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;You can also copy the example 1 code click on "FileNameHere" and press &lt;code&gt;ctrl + d&lt;/code&gt; twice. It will highlight both instances and you can just rename it to the name of the file.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Open a terminal in VS Code&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Start the React Server Again&lt;br&gt;
a. &lt;code&gt;npm start&lt;/code&gt; &lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h1&gt;
  
  
  Step 4
&lt;/h1&gt;

&lt;h3&gt;
  
  
  Setting up React-Router
&lt;/h3&gt;

&lt;h5&gt;
  
  
  In this step we are setting up the routing for the application. A few things to note:
&lt;/h5&gt;

&lt;h5&gt;
  
  
  *BrowserRouter must be wrapped at the highest possible level in the application but, this is not the only place that you can wrap BrowserRouter. You can also do it in your App.js file if you prefer
&lt;/h5&gt;

&lt;h5&gt;
  
  
  *You do not have to use "Switch."
&lt;/h5&gt;

&lt;h5&gt;
  
  
  *What is Switch? It is the same thing as a Switch statement in JS with reference to what place the path is in. For example if I were to Route Path to "/" and "about" without an exact or switch it would render both pages; first the home then the about right under it. You do not have to use "exact" when using Switch but, it is safer to do so in most use cases.
&lt;/h5&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Open index.js and import BrowserRouter from react-router-dom I rename it using "as"&lt;br&gt;
a. &lt;code&gt;|imd| (import destructured)&lt;/code&gt;&lt;br&gt;
b. &lt;code&gt;import { BrowserRouter as BR } from 'react-router-dom'&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Put a &lt;code&gt;"&amp;lt;BR&amp;gt;" tag before "&amp;lt;App /&amp;gt;"&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Put a &lt;code&gt;"&amp;lt;/BR&amp;gt;" tag after "&amp;lt;App /&amp;gt;"&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Your index.js file should now look like example 2&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Open your AppRouter file and Import Switch and Route from react-router-dom&lt;br&gt;
a. &lt;code&gt;imd&lt;/code&gt;&lt;br&gt;
b. &lt;code&gt;import { Switch as S, Route as R } from 'react-router-dom';&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Import your Home and About pages&lt;br&gt;
a. &lt;code&gt;import Home from '../pages/user/Home.jsx;&lt;/code&gt;&lt;br&gt;
b. &lt;code&gt;import About from '../pages/user/About.jsx;&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Replace the &lt;code&gt;"&amp;lt;Div&amp;gt;" tags with "&amp;lt;S&amp;gt;"&lt;/code&gt;&lt;br&gt;
a. Select the first div tag and press &lt;code&gt;ctrl +d&lt;/code&gt; twice then type &lt;code&gt;S&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Add an  exact route to the Home page and a non-exact route to the About page&lt;br&gt;
a. &lt;code&gt;&amp;lt;R exact path='/' component={Home} /&amp;gt;&lt;/code&gt;&lt;br&gt;
b. &lt;code&gt;&amp;lt;R path='/about/' component={About} /&amp;gt;&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h1&gt;
  
  
  Step 5
&lt;/h1&gt;

&lt;h3&gt;
  
  
  Setting up Navigation
&lt;/h3&gt;

&lt;h5&gt;
  
  
  When setting up Navigation in a react app you want to use NavLink or Link instead of anchor tags. Since React applications are "Single Page Applications" meaning that it is run out of a single index.html file, you do not want to use anchor tags becuase this will cause the app to reload everytime someone clikcs a link therefore the app would lose any state that it is holding on to. The only time you want to use anchor tags when developing a react application are to link to an external site or email address.
&lt;/h5&gt;

&lt;h5&gt;
  
  
  *NavLink is just an anchor tag that will have an active class when clicked. - Usually used in nav bars
&lt;/h5&gt;

&lt;h5&gt;
  
  
  *Link is just an anchor tag it will not have an active class attached to it. - Usually Used on pages
&lt;/h5&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Open your Home and About pages and add in an &lt;code&gt;&amp;lt;h1&amp;gt;&lt;/code&gt; that says ___ Page Works&lt;br&gt;
a. &lt;code&gt;&amp;lt;h1&amp;gt;___ Page Works&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Open your NavBar file and import NavLink from react-router-dom&lt;br&gt;
a. &lt;code&gt;imd&lt;/code&gt;&lt;br&gt;
b. &lt;code&gt;import { NavLink as NL } from 'react-router-dom';&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Create NavLinks to your Home and About Pages&lt;br&gt;
a. &lt;code&gt;&amp;lt;NL exact to='/'&amp;gt;Home&amp;lt;/NL&amp;gt;&lt;/code&gt;&lt;br&gt;
b. &lt;code&gt;&amp;lt;NL to='/about'&amp;gt;About&amp;lt;/NL&amp;gt;&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Your NavBar File Should look like example 4&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;In your Header.jsx file import NavBar and render it between the &lt;/p&gt; tags
a. &lt;code&gt;import NavBar from '../NavBar';&lt;/code&gt;
b. &lt;code&gt;&amp;lt;div&amp;gt; &amp;lt;NavBar /&amp;gt; &amp;lt;/div&amp;gt;&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Your Header file should look like example 5&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Add a footer if you would like you can see mine in example 6&lt;/p&gt;&lt;/li&gt;

&lt;h1&gt;
  
  
  Step 6
&lt;/h1&gt;
&lt;h3&gt;
  
  
  Tying it all together
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Open your App.js file and import Header, AppRouter, and Footer&lt;br&gt;
a. &lt;code&gt;import Header from './components/pages/Header.jsx';&lt;/code&gt;&lt;br&gt;
b. &lt;code&gt;import Footer from './components/pages/Footer.jsx';&lt;/code&gt;&lt;br&gt;
c. &lt;code&gt;import AppRouter from './configs/AppRouter.jsx';&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Between your app div render the above pages&lt;br&gt;
a. &lt;code&gt;&amp;lt;div className='App'&amp;gt; &amp;lt;Header /&amp;gt; &amp;lt;AppRouter /&amp;gt; &amp;lt;Footer /&amp;gt; &amp;lt;/div&amp;gt;&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Your App.js file should look like example 7&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;In your browser you should now see:&lt;br&gt;
a. NavLinks for Home and About &lt;br&gt;
b. ___ Page Works by pressing&lt;/p&gt;

&lt;p&gt;c. Your Footer&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Check the status on git&lt;br&gt;
a. &lt;code&gt;git status&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Add the Files&lt;br&gt;
a. &lt;code&gt;git add .&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Commit the changes&lt;br&gt;
a. &lt;code&gt;git commit&lt;/code&gt;&lt;br&gt;
b. &lt;code&gt;Enter a commit message&lt;/code&gt;&lt;br&gt;
c. &lt;code&gt;ctrl + x&lt;/code&gt;&lt;br&gt;
d. &lt;code&gt;y&lt;/code&gt;&lt;br&gt;
e. &lt;code&gt;enter&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Push the Changes to GitHub&lt;br&gt;
a. &lt;code&gt;git push&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Create a Pull Request&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Merge your pull request&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Checkout to master&lt;br&gt;
a. &lt;code&gt;git checkout master&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Pull master&lt;br&gt;
a. &lt;code&gt;git pull&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Congratulations! You Built a React Application with Application Routing.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Check the status on git&lt;br&gt;
a. &lt;code&gt;git status&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Add the Files&lt;br&gt;
a. &lt;code&gt;git add .&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Commit the changes&lt;br&gt;
a. &lt;code&gt;git commit&lt;/code&gt;&lt;br&gt;
b. &lt;code&gt;Enter a commit message&lt;/code&gt;&lt;br&gt;
c. &lt;code&gt;ctrl + x&lt;/code&gt;&lt;br&gt;
d. &lt;code&gt;y&lt;/code&gt;&lt;br&gt;
e. &lt;code&gt;enter&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Push the Changes to GitHub&lt;br&gt;
a. &lt;code&gt;git push&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Create a Pull Request&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Merge your pull request&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Checkout to master&lt;br&gt;
a. &lt;code&gt;git checkout master&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Pull master&lt;br&gt;
a. &lt;code&gt;git pull&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Congratulations! You Built a React Application with Application Routing.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h1&gt;
  
  
  Examples
&lt;/h1&gt;

&lt;h2&gt;
  
  
  Example 1 - React Arrow Function
&lt;/h2&gt;



&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import React from "react";

const YourFileNameHere = () =&amp;gt; {
  return (
&amp;lt;div&amp;gt;

&amp;lt;/div&amp;gt;
  );
};

export default YourFileNameHere;
&lt;/code&gt;&lt;/pre&gt;



&lt;h2&gt;
  
  
  Example 2 - Index.js After BrowserRouter Import
&lt;/h2&gt;



&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
import App from './App';
import * as serviceWorker from './serviceWorker';
import { BrowserRouter as BR } from 'react-router-dom'

ReactDOM.render(
&amp;lt;BR&amp;gt;
&amp;lt;App /&amp;gt;
&amp;lt;/BR&amp;gt;
, document.getElementById('root'));

// If you want your app to work offline and load faster, you can change
// unregister() to register() below. Note this comes with some pitfalls.
//* Learn more about service workers: https:*bit.ly/CRA-PWA 
serviceWorker.unregister();
&lt;/code&gt;&lt;/pre&gt;



&lt;h2&gt;
  
  
  Example 3 - AppRouter.jsx
&lt;/h2&gt;



&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import React from "react";
import { Route as R, Switch as S } from "react-router-dom";
import Home from "../pages/user/Home.jsx";
import About from "../pages/user/About.jsx";

const AppRouter = () =&amp;gt; {
  return (
&amp;lt;S&amp;gt;
  &amp;lt;R exact path="/" component={Home} /&amp;gt;
  &amp;lt;R path="/about" component={About} /&amp;gt;
&amp;lt;/S&amp;gt;
  );
};

export default AppRouter;

&lt;/code&gt;&lt;/pre&gt;



&lt;h2&gt;
  
  
  Example 4 - NavBar.jsx
&lt;/h2&gt;



&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import React from "react";
import { NavLink as NL } from "react-router-dom";
const NavBar = () =&amp;gt; {
  return (
&amp;lt;div&amp;gt;
  &amp;lt;NL exact to="/"&amp;gt;Home&amp;lt;/NL&amp;gt;
  &amp;lt;NL to="/about"&amp;gt;About&amp;lt;/NL&amp;gt;
&amp;lt;/div&amp;gt;
  );
};
&lt;/code&gt;&lt;/pre&gt;



&lt;h2&gt;
  
  
  Example 5 - Header.jsx
&lt;/h2&gt;



&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import React from "react";
import NavBar from "../NavBar.jsx";
const Header = () =&amp;gt; {
  return (
&amp;lt;div&amp;gt;
  &amp;lt;NavBar /&amp;gt;
&amp;lt;/div&amp;gt;
  );
};

export default Header;
&lt;/code&gt;&lt;/pre&gt;



&lt;h2&gt;
  
  
  Example 6 - Footer.jsx
&lt;/h2&gt;



&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import React from "react";

const Footer = () =&amp;gt; {
  return (
&amp;lt;div&amp;gt;
  &amp;lt;p&amp;gt;&amp;amp;copy;2020 SkylerWebDev&amp;lt;/p&amp;gt;
&amp;lt;/div&amp;gt;
  );
};

export default Footer;
&lt;/code&gt;&lt;/pre&gt;



&lt;h2&gt;
  
  
  Example 7 - App.js
&lt;/h2&gt;



&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import React from "react";
import "./App.css";
import AppRouter from "./configs/AppRouter.jsx";
import Header from "./components/pages/Header.jsx";
import Footer from "./components/pages/Footer.jsx";

const App = () =&amp;gt;{
  return (
&amp;lt;div className="App"&amp;gt;
  &amp;lt;Header /&amp;gt;
  &amp;lt;AppRouter /&amp;gt;
  &amp;lt;Footer /&amp;gt;
&amp;lt;/div&amp;gt;
  );
}

export default App;
&lt;/code&gt;&lt;/pre&gt;




&lt;/ol&gt;

</description>
      <category>react</category>
      <category>git</category>
      <category>github</category>
      <category>npm</category>
    </item>
  </channel>
</rss>
