<?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: ayubf</title>
    <description>The latest articles on DEV Community by ayubf (@ayubf).</description>
    <link>https://dev.to/ayubf</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%2F794652%2F309dee23-45ed-4115-a8b8-3cea2fcd2cf7.png</url>
      <title>DEV Community: ayubf</title>
      <link>https://dev.to/ayubf</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/ayubf"/>
    <language>en</language>
    <item>
      <title>Create a Flask App in 5 Minutes</title>
      <dc:creator>ayubf</dc:creator>
      <pubDate>Thu, 17 Mar 2022 21:42:08 +0000</pubDate>
      <link>https://dev.to/ayubf/create-a-flask-app-in-5-minutes-ohp</link>
      <guid>https://dev.to/ayubf/create-a-flask-app-in-5-minutes-ohp</guid>
      <description>&lt;p&gt;    When learning to build an API with a language like Python, Flask is a solid option. Starting out is simple and implimenting database queries and insertions are easier than you'd think thanks to ORMs (Object-Relation Mapper). Flask and other unopinionated frameworks in general shine when it comes to simplicity but can sometimes make your projects lack structure and direction compared to opinionated alternatives like Django. &lt;/p&gt;

&lt;p&gt;Before we can start this tutorial you should check if you have the required tools&lt;/p&gt;



&lt;h2&gt;
  
  
  Python &amp;amp; Pip
&lt;/h2&gt;

&lt;p&gt;    Python comes pre-installed on most Linux distros, and always pre-installed on macOS. You will have to install using the &lt;a href="https://www.python.org/" rel="noopener noreferrer"&gt;Python website&lt;/a&gt; for Windows if you don't have it installed already. To check if Python is on your system you can use &lt;code&gt;python --version&lt;/code&gt; or &lt;code&gt;python3 --version&lt;/code&gt;. Pip (Pip Installs Packages), is Python's package manager and comes with Python. &lt;/p&gt;



&lt;h2&gt;
  
  
  Step 1: Prepping Your Setup
&lt;/h2&gt;

&lt;p&gt;First open a new window with the terminal/command line application that comes with your operating system. &lt;/p&gt;

&lt;p&gt;Then Create a new directory for your project.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;mkdir &lt;/span&gt;flaskapp
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;From here you have to move into this new directory&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;cd &lt;/span&gt;flaskapp
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then you create a new virtual environment in this directory using Python's builtin virtual environment tool&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;macOS/Linux&lt;/th&gt;
&lt;th&gt;Windows&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;python3 -m venv venv&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;py -3 -m venv venv&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;After the environment is created we activate it&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;macOS/Linux&lt;/th&gt;
&lt;th&gt;Windows&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;. venv/bin/activate&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;venv\Scripts\activate&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Lastly comes installing Flask. Flask is the framework we'll be using today. It's a lightweight, unopinionated framework and really easy to use.&lt;/p&gt;

&lt;p&gt;Install it using &lt;code&gt;pip install Flask&lt;/code&gt; or   &lt;code&gt;pip3 install Flask&lt;/code&gt; depending on your Python version. &lt;/p&gt;



&lt;h2&gt;
  
  
  Step 2: Creating The Flask App
&lt;/h2&gt;

&lt;p&gt;Create a new filed called &lt;code&gt;app.py&lt;/code&gt; and type in the following:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;flask&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;Flask&lt;/span&gt;

&lt;span class="n"&gt;app&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Flask&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;__name__&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="nd"&gt;@app.route&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;/&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;HelloWorld&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Hello World!&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;

&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;__name__&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;__main__&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;run&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;debug&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="bp"&gt;True&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The first line in the file imports the &lt;code&gt;Flask&lt;/code&gt; object from the library. The next line initializes our Flask object as a variable we can use, add routes to and run. &lt;code&gt;@app.route('/')&lt;/code&gt; names the route and the function &lt;code&gt;HelloWorld&lt;/code&gt; is the function routed to the string in the decorator. It returns a string that will show when the URL is visited. The last two lines are sort of a safe guard in Python scripts to prevent unwanted execution, and will only do &lt;code&gt;app.run(debug=True)&lt;/code&gt; when the file itself is being run rather than imported.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 3: Running Your Flask App
&lt;/h2&gt;

&lt;p&gt;Open a window of your terminal/command line application and run&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;python flask.app
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Your terminal should show this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight markdown"&gt;&lt;code&gt;&lt;span class="p"&gt; *&lt;/span&gt; Serving Flask app 'app' (lazy loading)
&lt;span class="p"&gt; *&lt;/span&gt; Environment: production
   WARNING: This is a development server. Do not use it in a production deployment.
   Use a production WSGI server instead.
&lt;span class="p"&gt; *&lt;/span&gt; Debug mode: on
&lt;span class="p"&gt; *&lt;/span&gt; Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
&lt;span class="p"&gt; *&lt;/span&gt; Restarting with stat
&lt;span class="p"&gt; *&lt;/span&gt; Debugger is active!
&lt;span class="p"&gt; *&lt;/span&gt; Debugger PIN: 135-059-029
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And if you visit &lt;code&gt;http://localhost:5000&lt;/code&gt; or  you should see this:&lt;/p&gt;

&lt;p&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%2F5neyjw01voe9ppbn2moz.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%2F5neyjw01voe9ppbn2moz.png" alt="Successful run"&gt;&lt;/a&gt;&lt;/p&gt;



&lt;p&gt;    Python comes pre-installed on most Linux distros, and always pre-installed on macOS. You Congratulations! You just built a flask app. With an understanding of REST APIs you could add new routes that return different information, or even files. Using ORMs you could add functionality to create, retrieve, update or delete from a local or cloud database. With a framework like Flask, the limit is up to you.&lt;/p&gt;



&lt;h3&gt;
  
  
  Sources
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://www.python.org/" rel="noopener noreferrer"&gt;Python&lt;/a&gt;&lt;br&gt;
&lt;a href="https://flask.palletsprojects.com/en/2.0.x/" rel="noopener noreferrer"&gt;Flask&lt;/a&gt; &lt;br&gt;
&lt;a href="https://docs.python.org/3/library/venv.html" rel="noopener noreferrer"&gt;Venv&lt;/a&gt;&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>python</category>
      <category>flask</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Question Mark (?) Operators ASAP</title>
      <dc:creator>ayubf</dc:creator>
      <pubDate>Mon, 24 Jan 2022 00:58:22 +0000</pubDate>
      <link>https://dev.to/ayubf/question-mark-operators-asap-316d</link>
      <guid>https://dev.to/ayubf/question-mark-operators-asap-316d</guid>
      <description>&lt;p&gt;    If you've ever used conditionals in your code you've seen &lt;code&gt;if&lt;/code&gt; statements, and if you've seen &lt;code&gt;if&lt;/code&gt; statements you've seen them nested several layers deep. In your personal project this could be simply annoying and cause problems down the road but in production code this can be really problematic. &lt;/p&gt;

&lt;p&gt;    The ternary operator, &lt;code&gt;?:&lt;/code&gt;, is one Question Mark operator and a feature in some programming languages that makes conditional statemnts cleanier and easier to read. The basic syntax goes like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="nx"&gt;condition&lt;/span&gt; &lt;span class="p"&gt;?&lt;/span&gt; &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In use this would look like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;foo&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt; &lt;span class="p"&gt;?&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this snippet, &lt;code&gt;foo&lt;/code&gt; is 1, since the condition is &lt;code&gt;true&lt;/code&gt;, and &lt;code&gt;true&lt;/code&gt; is (obviously) a truthy value.&lt;/p&gt;

&lt;p&gt;If you're not sure what truthy/falsy values are just think of it this way:&lt;/p&gt;

&lt;p&gt;0, &lt;code&gt;false&lt;/code&gt;, &lt;code&gt;undefined&lt;/code&gt;, &lt;code&gt;NaN&lt;/code&gt;, empty strings, arrays, objects etc are falsy. All other values are truthy.&lt;/p&gt;

&lt;p&gt;If an expressions result is a falsy value then the statement itself is falsy.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is a falsy statement, because it returns &lt;code&gt;false&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;In this article I'll teach you how to use Question Mark operators, and their uses in ES2020.&lt;/p&gt;

&lt;h2&gt;
  
  
  Usages
&lt;/h2&gt;



&lt;h3&gt;
  
  
  Ternary Operator (&lt;code&gt;?&lt;/code&gt;)
&lt;/h3&gt;

&lt;p&gt;The first implementation of the &lt;code&gt;?&lt;/code&gt; in JavaScript is the simplest one, the one I showed at the beginning of the article, the ternary operator (&lt;code&gt;?:&lt;/code&gt;).&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="nx"&gt;conditon&lt;/span&gt; &lt;span class="p"&gt;?&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If the condition here is true, then the first value after the &lt;code&gt;?&lt;/code&gt; is either assigned or called.&lt;/p&gt;



&lt;h3&gt;
  
  
  Nullish Coalescing/Assignment (&lt;code&gt;??&lt;/code&gt;)
&lt;/h3&gt;

&lt;p&gt;The next implementation is the &lt;code&gt;??&lt;/code&gt; or nullish operator, which is used in Nullish Coalescing.&lt;/p&gt;

&lt;p&gt;Nullish coalescing looks something like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;value&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt; &lt;span class="o"&gt;??&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;    &lt;code&gt;value&lt;/code&gt; will become &lt;code&gt;true&lt;/code&gt;. You may be wondering now what's the difference between this and the Logical Or operator (&lt;code&gt;||&lt;/code&gt;)? The &lt;code&gt;||&lt;/code&gt; operator worked well but a problem a lot of people run into sometimes is that it considered values like empty compound types (&lt;code&gt;{}&lt;/code&gt;, &lt;code&gt;[]&lt;/code&gt;, &lt;code&gt;""&lt;/code&gt;) and 0 as falsy so the need for a logical operator that only considered &lt;code&gt;null&lt;/code&gt; and &lt;code&gt;undefined&lt;/code&gt; as falsy naturally arose.&lt;/p&gt;



&lt;h3&gt;
  
  
  Logical Nullish Assignment (&lt;code&gt;??=&lt;/code&gt;)
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="nx"&gt;x&lt;/span&gt; &lt;span class="o"&gt;??=&lt;/span&gt; &lt;span class="nx"&gt;y&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The third question mark operator is called the Logical Nullish assignment operator, &lt;code&gt;??=&lt;/code&gt;. The gist of this operator is to assign a value &lt;code&gt;y&lt;/code&gt; to a value &lt;code&gt;x&lt;/code&gt; if &lt;code&gt;x&lt;/code&gt; is &lt;code&gt;null&lt;/code&gt; or &lt;code&gt;undefined&lt;/code&gt;, and only if it is.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;val&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nx"&gt;val&lt;/span&gt; &lt;span class="o"&gt;??=&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="c1"&gt;// val is now 10, because it was null before&lt;/span&gt;


&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;num&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nx"&gt;num&lt;/span&gt; &lt;span class="o"&gt;??=&lt;/span&gt; &lt;span class="mi"&gt;20&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="c1"&gt;// num stays as 0, because 0 is neither undefined nor null&lt;/span&gt;

&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;egg&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nx"&gt;egg&lt;/span&gt; &lt;span class="o"&gt;??=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;scrambled&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="c1"&gt;// egg is now "scrambled" becuase uninitialized variables are undefined&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;h3&gt;
  
  
  Optional Chaining (&lt;code&gt;?.&lt;/code&gt;)
&lt;/h3&gt;

&lt;p&gt;    The last and latest question mark operator is a very useful feature. It allows us to access a value on the value of an object only if it exists. It gets rid of &lt;code&gt;if&lt;/code&gt; statements and &lt;code&gt;try..catch&lt;/code&gt; statements .In the event of a &lt;code&gt;null&lt;/code&gt; or &lt;code&gt;undefined&lt;/code&gt; value being returned, there is no error thrown, the value is just &lt;code&gt;null&lt;/code&gt; or &lt;code&gt;undefined&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;John&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;firstName&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;John&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;lastName&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Doe&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;age&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;21&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;parents&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Jack&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Jane&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;John&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;lastName&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="c1"&gt;// =&amp;gt; "John"&lt;/span&gt;

&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;John&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;bestFriend&lt;/span&gt;&lt;span class="p"&gt;?.&lt;/span&gt;&lt;span class="nx"&gt;age&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="c1"&gt;// =&amp;gt; undefined&lt;/span&gt;

&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;John&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;bestFriend&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;age&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="c1"&gt;// =&amp;gt; Error: Cannot read properties of undefined&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;h3&gt;
  
  
  Use in Other languages
&lt;/h3&gt;

&lt;p&gt;    Question mark operators exist in a large number of programming languages, as ternary operations are originally a mathematical concept, these are some examples:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Language&lt;/th&gt;
&lt;th&gt;Ternary or similar expression&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;C++, Java, JavaScript, C#, C, Bash, Ruby, Swift, PHP&lt;/td&gt;
&lt;td&gt;&lt;code&gt;condition ? if true : else;&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Python&lt;/td&gt;
&lt;td&gt;&lt;code&gt;value if conditon else false&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Rust&lt;/td&gt;
&lt;td&gt;&lt;code&gt;if condition {true} else {false}&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;R&lt;/td&gt;
&lt;td&gt;&lt;code&gt;if (condition) true else false&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Go&lt;/td&gt;
&lt;td&gt;No implimentation&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Haskell&lt;/td&gt;
&lt;td&gt;&lt;code&gt;if condition then true else false&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h3&gt;
  
  
  Conclusion
&lt;/h3&gt;

&lt;p&gt;    Now with your new-found knowledge of the question mark operators you can go impress your friends, colleagues, teammates or classmates, but don't overdo it. Question mark operators are prone to misuse and can make code unreadable if overused, so don't try to force it in whenever you can.&lt;/p&gt;



&lt;h4&gt;
  
  
  Sources
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Conditional_Operator"&gt;MDN Docs: Conditional (ternary) operator&lt;/a&gt; &lt;br&gt;&lt;br&gt;
&lt;a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Nullish_coalescing_operator"&gt;MDN Docs: Nullish coalescing operator (??)&lt;/a&gt; &lt;br&gt;&lt;br&gt;
&lt;a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Logical_nullish_assignment"&gt;MDN Docs: Logical nullish assignment (??=)&lt;/a&gt; &lt;br&gt;&lt;br&gt;
&lt;a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Optional_chaining"&gt;MDN Docs: Optional chaining (?.)&lt;/a&gt; &lt;br&gt;&lt;br&gt;
&lt;a href="https://en.wikipedia.org/wiki/%3F:"&gt;Wikipedia: ?:&lt;/a&gt;&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>programming</category>
      <category>tutorial</category>
      <category>functional</category>
    </item>
    <item>
      <title>Create A React Router App ASAP</title>
      <dc:creator>ayubf</dc:creator>
      <pubDate>Sat, 22 Jan 2022 01:28:23 +0000</pubDate>
      <link>https://dev.to/ayubf/create-a-react-router-app-in-5-minutes-3ccp</link>
      <guid>https://dev.to/ayubf/create-a-react-router-app-in-5-minutes-3ccp</guid>
      <description>&lt;p&gt;    Have you ever created a React app and wondered what it would take to add routes? Have, let's say, a seperate &lt;br&gt;
page for your posts and pictures? Routes are a basic concept in web development and are necessary for any web development framework, frontend or backend. This is especially essential for RESTful APIs that take advantage of the ability for routes to output different pages, carry out different functions like logging in, logging out, etc. In this article I'll show you how to set up routes in React with a library called React Router.&lt;/p&gt;



&lt;p&gt;Before you can start you should make sure you have the proper packages and tools installed. &lt;br&gt;&lt;/p&gt;


&lt;h3&gt;
  
  
  Node &amp;amp; NPM
&lt;/h3&gt;

&lt;p&gt;    Node is the environment that runs JavaScript frameworks and libraries like React and is essential for projects like these. NPM is the package manager for Node, and that basically means NPM installs the required files to use React and other libraries. We will use it later in this article to install libraries.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://nodejs.dev/"&gt;Install Node.js&lt;/a&gt;&lt;/p&gt;


&lt;h3&gt;
  
  
  Text Editor
&lt;/h3&gt;

&lt;p&gt;    To put it simply, a text editor is just the application on your computer that will edit the text files to create the React app. My personal choice is one called VSCode, but there are other good options like Sublime Text, Notepad++, &amp;amp; Atom, but even your default text editor can get the job done.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://code.visualstudio.com/"&gt;Install VSCode&lt;/a&gt;&lt;/p&gt;




&lt;h3&gt;
  
  
  Step 1: Creating React App
&lt;/h3&gt;

&lt;p&gt;    To initiate the React app we'll use a tool that's gonna make the process much simpler. Run the command below to create the React app.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npx create-react-app reactrouterapp
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;npx&lt;/code&gt; is a package bundled with &lt;code&gt;npm&lt;/code&gt; and is used to execute.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;cd &lt;/span&gt;reactrouterapp
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;cd&lt;/code&gt; will move us into the directory for the React app.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm i react-router react-router-dom
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This command installs the required packages for this app. &lt;/p&gt;



&lt;h3&gt;
  
  
  Step 2: Adding Routes
&lt;/h3&gt;

&lt;p&gt;    In this step we will create the app's routes and route outputs. First open the &lt;code&gt;/src&lt;/code&gt; folder inside the &lt;code&gt;reactrouterapp&lt;/code&gt; directory.&lt;br&gt;
Create a new file named &lt;code&gt;Page.js&lt;/code&gt; and type the following&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;    &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;Page&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
            &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;h1&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;This&lt;/span&gt; &lt;span class="nx"&gt;is&lt;/span&gt; &lt;span class="nx"&gt;the&lt;/span&gt; &lt;span class="nx"&gt;Page&lt;/span&gt; &lt;span class="nx"&gt;component&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/h1&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;            &lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="nx"&gt;Page&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;    The function &lt;code&gt;Page()&lt;/code&gt; returns a JSX object in its' &lt;code&gt;return&lt;/code&gt; statement. The &lt;code&gt;export default&lt;/code&gt; statement at the bottom lets us use this in other files, very convenient.&lt;/p&gt;

&lt;p&gt;Next, change the contents of &lt;code&gt;App.js&lt;/code&gt; to the following:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;BrowserRouter&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="nx"&gt;Router&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;Routes&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;Route&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;react-router-dom&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;Page&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;./Page&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;

    &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;App&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="k"&gt;return &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;div&lt;/span&gt; &lt;span class="nx"&gt;className&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;App&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
          &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;Router&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
            &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;Routes&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
              &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;Route&lt;/span&gt; &lt;span class="nx"&gt;path&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;/page&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="nx"&gt;element&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;Page&lt;/span&gt; &lt;span class="o"&gt;/&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="sr"&gt;/&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;            &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/Routes&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;          &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/Router&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;        &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/div&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;      &lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="nx"&gt;App&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;    The first line imports from the React Router library, and it imports three components for our routing&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;BrowserRouter&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="nx"&gt;Router&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;Routes&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;Route&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;react-router-dom&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;    The second line imports from our &lt;code&gt;Page.js&lt;/code&gt; file from earlier, and it imports the &lt;code&gt;&amp;lt;Page /&amp;gt;&lt;/code&gt; component we created earlier.&lt;/p&gt;

&lt;p&gt;The function &lt;code&gt;App()&lt;/code&gt; returns this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;        &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;div&lt;/span&gt; &lt;span class="nx"&gt;className&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;App&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
          &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;Router&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
            &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;Routes&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
              &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;Route&lt;/span&gt; &lt;span class="nx"&gt;path&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;/page&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="nx"&gt;element&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;Page&lt;/span&gt; &lt;span class="o"&gt;/&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="sr"&gt;/&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;            &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/Routes&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;          &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/Router&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;        &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/div&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;    Routes holds the routes and with the &lt;code&gt;path=&lt;/code&gt; parameter can have a prefix. &lt;code&gt;&amp;lt;Route&amp;gt;&lt;/code&gt; defines the specific routes, their paths, and the elements rendered (in this example that's our &lt;code&gt;&amp;lt;Page /&amp;gt;&lt;/code&gt; component).&lt;/p&gt;

&lt;p&gt;The app will return the &lt;code&gt;&amp;lt;Page /&amp;gt;&lt;/code&gt; element when the &lt;code&gt;/page&lt;/code&gt; route is visited.&lt;/p&gt;



&lt;h3&gt;
  
  
  Step 3: Running
&lt;/h3&gt;

&lt;p&gt;To run the app run the follow command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;npm start
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The out put should be something like this.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;    Compiled successfully!

    You can now view reactrouterapp &lt;span class="k"&gt;in &lt;/span&gt;the browser.

      Local:            http://localhost:3000
      On Your Network:  http://10.0.0.87:3000

    Note that the development build is not optimized.
    To create a production build, use npm run build.

    assets by status 6.93 KiB &lt;span class="o"&gt;[&lt;/span&gt;cached] 1 asset
    assets by chunk 1.6 MiB &lt;span class="o"&gt;(&lt;/span&gt;name: main&lt;span class="o"&gt;)&lt;/span&gt;
      asset static/js/bundle.js 1.53 MiB &lt;span class="o"&gt;[&lt;/span&gt;emitted] &lt;span class="o"&gt;(&lt;/span&gt;name: main&lt;span class="o"&gt;)&lt;/span&gt; 1 related asset
      asset main.cdf5e8aba95c1b3dac48.hot-update.js 71.4 KiB &lt;span class="o"&gt;[&lt;/span&gt;emitted] &lt;span class="o"&gt;[&lt;/span&gt;immutable] &lt;span class="o"&gt;[&lt;/span&gt;hmr] &lt;span class="o"&gt;(&lt;/span&gt;name: main&lt;span class="o"&gt;)&lt;/span&gt; 1 related asset
    assets by path &lt;span class="k"&gt;*&lt;/span&gt;.json 611 bytes
      asset asset-manifest.json 583 bytes &lt;span class="o"&gt;[&lt;/span&gt;emitted]
      asset main.cdf5e8aba95c1b3dac48.hot-update.json 28 bytes &lt;span class="o"&gt;[&lt;/span&gt;emitted] &lt;span class="o"&gt;[&lt;/span&gt;immutable] &lt;span class="o"&gt;[&lt;/span&gt;hmr]
    asset index.html 1.67 KiB &lt;span class="o"&gt;[&lt;/span&gt;emitted]
    Entrypoint main 1.6 MiB &lt;span class="o"&gt;(&lt;/span&gt;1.62 MiB&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; static/js/bundle.js 1.53 MiB main.cdf5e8aba95c1b3dac48.hot-update.js 71.4 KiB 2 auxiliary assets
    cached modules 1.41 MiB &lt;span class="o"&gt;[&lt;/span&gt;cached] 107 modules
    runtime modules 31.3 KiB 15 modules
    javascript modules 3.95 KiB
      ./src/index.js 1.81 KiB &lt;span class="o"&gt;[&lt;/span&gt;code generated]
      ./src/App.js 2.14 KiB &lt;span class="o"&gt;[&lt;/span&gt;built] &lt;span class="o"&gt;[&lt;/span&gt;code generated]
    webpack 5.67.0 compiled successfully &lt;span class="k"&gt;in &lt;/span&gt;75 ms
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;    Visit the link in the output, either one of them, and then visit the &lt;code&gt;/page&lt;/code&gt; route and you should see something like this.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fceqc6i3r2f5v0n3g25qk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fceqc6i3r2f5v0n3g25qk.png" alt="Successfully run React app with React Router" width="483" height="191"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;    Congrats! You quickly created a React app with routes using React Router. Understanding &amp;amp; using routes and routing is a crucial skill for a wev developer, this will come up often in projects or on the job.&lt;/p&gt;



&lt;h4&gt;
  
  
  Sources
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://reactrouter.com/docs/en/v6"&gt;React Router v6&lt;/a&gt; &lt;br&gt;
&lt;a href="https://create-react-app.dev"&gt;Create-React-App&lt;/a&gt;&lt;br&gt;
&lt;a href="https://reactjs.org"&gt;React&lt;/a&gt;&lt;br&gt;
&lt;a href="https://nodejs.org/en"&gt;Node.js&lt;/a&gt;&lt;br&gt;
&lt;a href="https://docs.npmjs.com"&gt;Npm&lt;/a&gt;&lt;br&gt;
&lt;a href="https://code.visualstudio.com"&gt;VSCode&lt;/a&gt;&lt;br&gt;
&lt;a href="https://www.npmjs.com/package/npx"&gt;Npx&lt;/a&gt;&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>webdev</category>
      <category>react</category>
      <category>tutorial</category>
    </item>
  </channel>
</rss>
