Mahamudul Hasan Rubel
HomeAboutProjectsSkillsExperienceBlogCoursesPhotosContact
Mahamudul Hasan Rubel

Senior Software Engineer crafting high-performance web applications and SaaS platforms.

Navigation

  • Home
  • About
  • Projects
  • Skills
  • Experience
  • Blog
  • Courses
  • Photos
  • Contact

Get in Touch

Available for senior/lead roles and consulting.

bd.mhrubel@gmail.comHire Me

© 2026 Mahamudul Hasan Rubel. All rights reserved.

Built with using Next.js 16 & Tailwind v4

Back to Blog
Lesson 5 of the React Fundamentals: Build Modern UIs from Scratch course
ReactJune 25, 20263 min read

Creating Static Components: Building Your First React UI Layout

Master functional components in React. Learn how to define, export, and import code to build a professional, modular UI layout for your movie-browser app.

ReactFunctional ComponentsUI LayoutWeb DevelopmentBeginnersjavascriptfrontend

Previously in this course, we covered the essentials of Mastering JSX Syntax: Writing Declarative React Components. We moved beyond standard HTML to describe our UI as a tree of JavaScript functions.

Now, we’re going to take that knowledge and organize it. Instead of dumping all our code into a single file, we’ll learn to break our interface into reusable, maintainable functional components. This is the core of professional React development—building a clean, modular UI layout that scales as your project grows.

Defining Functional Components

A functional component in React is just a plain JavaScript function that returns JSX. If you can write a function, you can write a React component.

Here is the mental model: A component is a blueprint for a piece of your user interface. When React renders, it calls your function, receives the JSX, and updates the DOM to match.

JSX
// A simple functional component
function Header() {
  return (
    <header>
      <h1>Movie Browser</h1>
    </header>
  );
}

There are two strict rules for naming and defining components:

  1. Capitalization: Always name your components with a capital letter (e.g., Header, not header). React treats lowercase tags as standard HTML elements and capitalized tags as custom components.
  2. Return Value: A component must return valid JSX. If you need to return multiple elements, wrap them in a parent element or a React Fragment (<>...</>).

Structuring the App Layout

To build our movie browser, we need a standard React structure. We'll separate our concerns by creating a components directory. This keeps our root App.jsx clean and readable.

Let’s create our first two components: Header and Footer.

1. Creating the Header

Create a file named src/components/Header.jsx:

JSX
export default function Header() {
  return (
    <header style={{ padding: CE9178">'1rem', background: CE9178">'#333', color: CE9178">'#fff' }}>
      <h1>My Movie Browser</h1>
    </header>
  );
}

2. Creating the Footer

Create a file named src/components/Footer.jsx:

JSX
export default function Footer() {
  return (
    <footer style={{ marginTop: CE9178">'2rem', textAlign: CE9178">'center' }}>
      <p>&copy; 2023 Movie Browser Inc.</p>
    </footer>
  );
}

Exporting and Importing Components

In modern React, we use ES modules to share code. By using export default, we make the component available to be imported elsewhere.

Now, open your src/App.jsx file. We will import these components and assemble our basic UI layout:

JSX
import Header from CE9178">'./components/Header';
import Footer from CE9178">'./components/Footer';

function App() {
  return (
    <div>
      <Header />
      <main>
        <p>Welcome to my movie app!</p>
      </main>
      <Footer />
    </div>
  );
}

export default App;

By organizing our code this way, we've successfully transitioned from a single-file script to a component-based architecture. If you need to change the header later, you only touch Header.jsx.

Hands-on Exercise: Build the Sidebar

To solidify this, let’s add a Sidebar component.

  1. Create a new file src/components/Sidebar.jsx.
  2. Define a function that returns a <nav> element with a list of links (e.g., "Home", "Popular", "Favorites").
  3. Export it, import it into App.jsx, and place it inside the <main> container, next to your existing paragraph.

Common Pitfalls

  • Forgetting the Export: If you define a component but forget export default, your App.jsx will throw an error saying the module cannot be found.
  • Case Sensitivity: React is strict. If your file is header.jsx but you try to import Header, some build tools might complain, or you might run into issues when deploying to case-sensitive servers (like Linux). Always use PascalCase for component filenames.
  • Returning Multiple Top-Level Elements: Remember, return (<div>...</div> <div>...</div>) is invalid. If you need two adjacent elements, wrap them in a single div or a Fragment: return (<><div>...</div><div>...</div></>).

Recap

We've moved from writing basic JSX to architecting a real application. By defining functional components, we’ve created modular, reusable pieces of UI. We used export and import to manage our React structure, ensuring that our App.jsx remains a clean entry point for our layout. This modularity is the foundation of everything else we will build in this course, including Introduction to Component-Based Architecture in React.

Up next: We will bring these static components to life by learning how to apply styles and make them look professional.

Previous lessonMastering JSX SyntaxNext lesson Styling Components
Back to Blog

Similar Posts

ReactReactJune 25, 20263 min read

Fetching Data from an API: A Practical React Guide

Master the fetch API in React to retrieve external data. Learn to perform asynchronous requests and store JSON responses in your component state effectively.

Read more
ReactReactJune 25, 20263 min read

Part of the course

React Fundamentals: Build Modern UIs from Scratch

beginner · Lesson 5 of 49

  1. 1

    Introduction to Component-Based Architecture

    4 min
  2. 2

    Understanding the Virtual DOM

    4 min
  3. 3

    Setting Up with Vite

    3 min

Building a Movie Filter Toggle in React: A Beginner's Guide

Master the art of UI state management by adding a filter toggle to your movie app. Learn to control list rendering using boolean state and checkbox inputs.

Read more
ReactReactJune 25, 20264 min read

Rendering Lists of Data in React: A Practical Guide

Learn how to use the map method for list rendering in React. Master the key prop to keep your dynamic movie lists efficient, performant, and bug-free.

Read more
4

Mastering JSX Syntax

4 min
  • 5

    Creating Static Components

    3 min
  • 6

    Styling Components

    3 min
  • 7

    Passing Data with Props

    3 min
  • 8

    Dynamic Movie Cards

    3 min
  • 9

    Component Composition

    3 min
  • 10

    Conditional Rendering

    3 min
  • 11

    Rendering Lists of Data

    4 min
  • 12

    The Key Prop Explained

    4 min
  • 13

    Introduction to React State

    4 min
  • 14

    Managing State with useState

    3 min
  • 15

    Building an Interactive Search Bar

    3 min
  • 16

    Handling Click Events

    4 min
  • 17

    Updating State Based on Previous State

    4 min
  • 18

    Filtering the Movie List

    3 min
  • 19

    Handling Form Submissions

    3 min
  • 20

    Controlled Components

    4 min
  • 21

    Event Bubbling and Propagation

    3 min
  • 22

    Building a Movie Filter Toggle

    3 min
  • 23

    Introduction to Side Effects

    4 min
  • 24

    useEffect Dependencies

    4 min
  • 25

    Fetching Data from an API

    3 min
  • 26

    Handling Loading States

    3 min
  • 27

    Managing Errors

    3 min
  • 28

    Cleanup Functions in useEffect

    3 min
  • 29

    Debouncing Search Input

    3 min
  • 30

    Refactoring for Clean Code

    3 min
  • 31

    Folder Structure Best Practices

    4 min
  • 32

    Extracting Custom Hooks

    3 min
  • 33

    Prop Drilling and Context API

    Coming soon
  • 34

    Polishing the UI

    Coming soon
  • 35

    Finalizing the Movie Browser

    Coming soon
  • 36

    Review of Component Lifecycle

    Coming soon
  • 37

    Review of State Management

    Coming soon
  • 38

    Building a Modal Component

    Coming soon
  • 39

    Introduction to PropTypes

    Coming soon
  • 40

    Performance Optimization Basics

    Coming soon
  • 41

    Handling Browser History

    Coming soon
  • 42

    Working with LocalStorage

    Coming soon
  • 43

    Building a Favorites List

    Coming soon
  • 44

    Handling Media in React

    Coming soon
  • 45

    Introduction to Testing

    Coming soon
  • 46

    Debugging React Apps

    Coming soon
  • 47

    Deployment Basics

    Coming soon
  • 48

    Using External Libraries

    Coming soon
  • 49

    Advanced

    Coming soon
  • View full course