<?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>Forem: Mahiya Khan</title>
    <description>The latest articles on Forem by Mahiya Khan (@mahiya_khan_1d2dc6061abb7).</description>
    <link>https://forem.com/mahiya_khan_1d2dc6061abb7</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%2F1530946%2F9dbf5e64-f4df-4e72-8bb0-f8378400e351.png</url>
      <title>Forem: Mahiya Khan</title>
      <link>https://forem.com/mahiya_khan_1d2dc6061abb7</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/mahiya_khan_1d2dc6061abb7"/>
    <language>en</language>
    <item>
      <title>Ready to Dive into React? Let's Build Your First App!</title>
      <dc:creator>Mahiya Khan</dc:creator>
      <pubDate>Tue, 09 Jul 2024 18:43:20 +0000</pubDate>
      <link>https://forem.com/mahiya_khan_1d2dc6061abb7/ready-to-dive-into-react-lets-build-your-first-app-2j0p</link>
      <guid>https://forem.com/mahiya_khan_1d2dc6061abb7/ready-to-dive-into-react-lets-build-your-first-app-2j0p</guid>
      <description>&lt;p&gt;So you're ready to learn React, the powerful JavaScript library for building dynamic user interfaces!  That's awesome.  But before we start building fancy components, we need a solid foundation. Let's get your first React app up and running! &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1.  Node.js and npm (or yarn): Your Development Tools&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Think of Node.js as the engine that powers your React app, and npm (or yarn) as the toolbox. You need both!  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Get Node.js:&lt;/strong&gt; Head to &lt;a href="https://nodejs.org/" rel="noopener noreferrer"&gt;https://nodejs.org/&lt;/a&gt; and download the installer for your operating system.  This comes with npm, the package manager you'll use to install React and other tools.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Verify Your Installation:&lt;/strong&gt; Open your terminal or command prompt and type &lt;code&gt;node -v&lt;/code&gt; and &lt;code&gt;npm -v&lt;/code&gt;.  You should see the versions of Node.js and npm installed.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;2. Create Your React App&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Now for the fun part! Let's create a new React project using Create React App, a tool that sets up everything you need:&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 my-react-app
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Replace &lt;code&gt;my-react-app&lt;/code&gt; with your desired project name. This command will:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Download the necessary files.&lt;/li&gt;
&lt;li&gt;Install React and related dependencies.&lt;/li&gt;
&lt;li&gt;Create a basic app structure.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;3. Navigate into Your Project&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Once Create React App finishes, open your terminal and navigate to your project 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;my-react-app
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;4. Start the Development Server&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Let's fire up the development server to see your app in action!&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



&lt;p&gt;This will usually open your default browser to &lt;code&gt;http://localhost:3000/&lt;/code&gt; where you'll see the default React welcome page.  Yay!  You've successfully created your first React app.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;5. Explore the Files&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Open the project folder in your code editor (VS Code is a popular choice). You'll find:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;src&lt;/code&gt; directory:&lt;/strong&gt;  This is where your React code will live.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;public&lt;/code&gt; directory:&lt;/strong&gt;  This holds static assets like your HTML (&lt;code&gt;index.html&lt;/code&gt;) and CSS (&lt;code&gt;index.css&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;package.json&lt;/code&gt;:&lt;/strong&gt;  This file lists the dependencies of your project.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;README.md&lt;/code&gt;:&lt;/strong&gt;  This file contains instructions and information about the project.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Let's Make Changes&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Now, let's make a simple change to see how React works. In the &lt;code&gt;src/App.js&lt;/code&gt; file, replace the contents with:&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="nx"&gt;React&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;react&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&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="o"&gt;&amp;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;Hello&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;React&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="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;Save the file, and your browser will automatically refresh to show your new heading! &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Tips for Success&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Experiment!&lt;/strong&gt; Change the text, add more elements, and play around to see what happens.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Documentation is your friend:&lt;/strong&gt;  &lt;a href="https://reactjs.org/" rel="noopener noreferrer"&gt;https://reactjs.org/&lt;/a&gt; is a great resource for learning React.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Community Support:&lt;/strong&gt; There's a fantastic community of React developers. Don't hesitate to ask questions!&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;That's it!  You've built your first React app. Now, the fun part begins –  learning how to create interactive and dynamic user experiences with React! &lt;/p&gt;

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