<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Build, Break & Learn]]></title><description><![CDATA[Build, Break & Learn]]></description><link>https://buildbreakandlearn.hashnode.dev</link><image><url>https://cdn.hashnode.com/uploads/logos/6b09180ae0ab23c86545aa96/8b136d98-30c5-428d-af24-1b4e97fffbf2.png</url><title>Build, Break &amp; Learn</title><link>https://buildbreakandlearn.hashnode.dev</link></image><generator>RSS for Node</generator><lastBuildDate>Fri, 04 Dec 2026 21:45:39 GMT</lastBuildDate><atom:link href="https://buildbreakandlearn.hashnode.dev/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[Understanding React: Components, Imports, Exports, and Application Structure]]></title><description><![CDATA[Learn React basics, including components, JSX, imports, exports, and application structure. Understand React app flow using CRA and Vite.]]></description><link>https://buildbreakandlearn.hashnode.dev/understanding-react-components-imports-exports-and-application-structure</link><guid isPermaLink="true">https://buildbreakandlearn.hashnode.dev/understanding-react-components-imports-exports-and-application-structure</guid><category><![CDATA[React]]></category><category><![CDATA[JavaScript]]></category><dc:creator><![CDATA[Romi Mawandia]]></dc:creator><pubDate>Fri, 27 Nov 2026 06:24:34 GMT</pubDate><content:encoded><![CDATA[<p>Today, I started understanding how React applications work, focusing on their basic flow and structure.</p>
<p>Instead of jumping directly into building complex applications, I wanted to understand how everything connects behind the scenes.</p>
<p>Here are my key learnings.</p>
<ol>
<li>Understanding the React Application Flow</li>
</ol>
<p>I started by creating a React application using Create React App (CRA).</p>
<p>My first goal was to understand how a React application is structured and how its different parts work together.</p>
<p>I learned how to:</p>
<p>Create a React application.</p>
<p>Understand the basic application structure.</p>
<p>Create reusable components.</p>
<p>Export components from one file.</p>
<p>Import components into another file.</p>
<p>Use imported components like HTML tags.</p>
<ol start="2">
<li>Creating and Using Components</li>
</ol>
<p>One of the first things I learned was how to create a React component.</p>
<p>For example:</p>
<p>function Welcome() { return</p>
<h1>Hello, React!</h1>
<p>; }</p>
<p>export default Welcome;</p>
<p>Here, Welcome is a React component.</p>
<p>To use this component in another file, we first need to import it.</p>
<p>import Welcome from "./Welcome";</p>
<p>function App() { return ; }</p>
<p>export default App;</p>
<p>An interesting thing I learned is that we can use our custom components just like HTML elements.</p>
<p>For example:</p>
<p>is an HTML element.</p>
<p>is a React component.</p>
<p>Important: React component names should start with an uppercase letter.</p>
<p>Why?</p>
<p>Because React uses capitalization to distinguish between built-in HTML elements and custom React components.</p>
<p>Lowercase names are treated as built-in elements, while uppercase names are treated as custom components.</p>
<ol start="3">
<li>JavaScript vs JSX File Extensions</li>
</ol>
<p>Another interesting thing I learned is that React components can be written in both .js and .jsx files.</p>
<p>For example:</p>
<p>App.js</p>
<p>App.jsx</p>
<p>Both extensions can be used for React components, provided the project tooling supports JSX transformation.</p>
<p>The .jsx extension simply makes it easier to identify files containing JSX.</p>
<ol start="4">
<li>Understanding index.html in Create React App</li>
</ol>
<p>I also explored the public folder and found the index.html file.</p>
<p>This file acts as the HTML entry point of the application.</p>
<p>One interesting thing I noticed was that the HTML file doesn't contain a manually written script tag for our main React application.</p>
<p>So, how does React execute our JavaScript code?</p>
<p>The development tooling handles this process. It bundles or transforms the application and injects the required script into the generated HTML.</p>
<p>This happens behind the scenes, so developers don't have to manually connect every JavaScript file to the HTML document.</p>
<ol start="5">
<li>Understanding React Structure in Vite</li>
</ol>
<p>After exploring Create React App, I also looked at how a React application is structured when created using Vite.</p>
<p>One important difference I noticed is the location of index.html.</p>
<p>In a typical Vite React project, the structure looks like this:</p>
<p>my-react-app/ │ ├── index.html ├── package.json ├── vite.config.js │ └── src/ ├── main.jsx ├── App.jsx └── components/ └── Welcome.jsx</p>
<p>Unlike Create React App, Vite keeps index.html in the project root rather than inside the public folder.</p>
<p>The index.html file contains a script reference to the application entry point, usually src/main.jsx.</p>
<p>For example:</p>
<p>This is where Vite starts loading the React application.</p>
<ol start="6">
<li>Understanding JSX and Multiple Elements</li>
</ol>
<p>Another concept I learned was that JSX doesn't allow us to return multiple adjacent elements without a common parent.</p>
<p>For example, this won't work:</p>
<p>function App() { return (</p>
<h1>Hello</h1>
<p>Welcome to React</p>
<p>); }</p>
<p>To solve this, we can wrap multiple elements inside a parent element.</p>
<p>Using a div:</p>
<p>function App() { return (</p>
<h1>Hello</h1>
<p>Welcome to React</p>
<p>); }</p>
<p>Using a React Fragment:</p>
<p>function App() { return ( &lt;&gt;</p>
<h1>Hello</h1>
<p>Welcome to React</p>
<p>&lt;/&gt; ); }</p>
<p>The interesting difference is that a div creates an additional DOM element, whereas a Fragment doesn't add an extra DOM node.</p>
<p>Key Takeaways</p>
<p>Today, I understood the following concepts:</p>
<p>How a basic React application is structured.</p>
<p>How to create reusable components.</p>
<p>How to export and import components.</p>
<p>How to use custom components like HTML elements.</p>
<p>Why React component names start with uppercase letters.</p>
<p>The difference between .js and .jsx extensions.</p>
<p>The role of index.html in a React application.</p>
<p>How Create React App and Vite organize their project structures.</p>
<p>Why we use div or React Fragments to wrap multiple JSX elements.</p>
<p>Final Thoughts</p>
<p>I'm trying to understand concepts by connecting the pieces rather than memorizing isolated rules.</p>
<p>Today wasn't about building something complex. It was about understanding the foundation of React and how its basic structure works.</p>
<p>One step at a time. One concept at a time.</p>
<p>Learning is not just about writing code; it's also about understanding why things work the way they do.</p>
]]></content:encoded></item></channel></rss>