πŸ“ Description

Ready to learn React in 2025? This crash course walks you through creating your first real-world React app with hooks, components, and JSX.

βœ… What you'll learn:

* Setting up React with Create React App

* JSX, Props, State & Hooks

* Styling, Conditional Rendering, Lists

* Component architecture & folder structure

#ReactJS #CrashCourse #WebDevelopment #JavaScript #FrontendDev #ReactHooks #React2025

πŸš€ React.js Crash Course 2025 – Build Your First App from Scratch

Welcome to this beginner-friendly React.js crash course for 2025! Whether you're transitioning from HTML, CSS, and JavaScript or starting fresh, this tutorial will give you a rock-solid foundation in React with best practices, clean structure, and modern JavaScript techniques.

πŸ“¦ Step 1: What Is React.js?

React is a JavaScript library for building user interfaces, created and maintained by Meta (Facebook). It allows you to create reusable components, use a virtual DOM for faster rendering, and structure your frontend with clean, component-based architecture.

React is not a full-blown framework like Angularβ€”think of it as the view layer of your app. It’s great for building single-page applications (SPAs).

🧱 Step 2: Setting Up React

βœ… Prerequisites:

* Node.js & npm (Install from nodejs.org)

* A code editor like VS Code

πŸ›  Create a New React App

npx create-react-app my-app

Replace my-app with your project name.

Navigate into your app:

cd my-app

Start the app:

npm start

Your React app will open at

http://localhost:3000

πŸ“‚ Step 3: Project Structure Overview

React generates this structure:

my-app/

β”œβ”€β”€ node_modules/

β”œβ”€β”€ public/

β”‚ └── index.html

β”œβ”€β”€ src/

β”‚ β”œβ”€β”€ App.js

β”‚ β”œβ”€β”€ App.css

β”‚ β”œβ”€β”€ index.js

β”‚ └── components/ (your custom folder)

β”œβ”€β”€ package.json

* App.js: Main component

* App.css: Main stylesheet

* index.js: App entry point

🧩 Step 4: Understanding JSX & Components

Create a Functional Component

// src/components/Welcome.jsx

function Welcome({ message = "World" }) {

return

Hello {message}!;

}

export default Welcome;

Import & Use It

// App.js

import Welcome from './components/Welcome';

function App() {

return (

);

}

JSX Notes

* Always return a single root element (use <>...> if needed).

* Use className instead of class.

βš›οΈ Step 5: Using State with useState

import { useState } from 'react';

function App() {

const [count, setCount] = useState(0);

return (

Count: {count}

setCount(count + 1)}>Increment

);

}

⏱ Step 6: Using Effects with useEffect

import { useEffect, useState } from 'react';

function App() {

const [seconds, setSeconds] = useState(0);

useEffect(() => {

const interval = setInterval(() => {

setSeconds(s => s + 1);

}, 1000);

return () => clearInterval(interval); // Cleanup

}, []);

return

Time passed: {seconds}s

;

}

🎨 Step 7: Styling in React

Option 1: CSS File

/* App.css */

.App {

background-color: aqua;

height: 100vh;

}

Option 2: Inline Style

const myStyle = {

backgroundColor: 'black',

color: 'white',

fontSize: '2rem'

};

return

Styled Heading;

πŸ” Step 8: Conditional Rendering

const [isLoggedIn, setIsLoggedIn] = useState(false);

return (

{isLoggedIn ? : }

setIsLoggedIn(!isLoggedIn)}>Toggle Login

);

Or with &&:

{hasAccess && }

🧾 Step 9: Lists and Keys

const items = ["A", "B", "C"];

return (

{items.map((item, index) => (

{item}

))}

);

⚠️ Use unique IDs for production (not index as key).

πŸ—‚ Step 10: Folder Structure Best Practices

src/

β”œβ”€β”€ components/

β”‚ β”œβ”€β”€ Header.jsx

β”‚ β”œβ”€β”€ Button.jsx

β”œβ”€β”€ pages/

β”‚ β”œβ”€β”€ Home.jsx

β”‚ β”œβ”€β”€ About.jsx

β”œβ”€β”€ hooks/

β”‚ └── useToggle.js

β”œβ”€β”€ App.js

β”œβ”€β”€ index.js

Clean up unused files like logo.svg, App.test.js, etc.

πŸš€ Next Steps

* Use React Router for navigation

* Deploy using Vercel or Netlify

* Add form handling and API calls

Stay tuned for the next part where we build a real React project from scratch!

Download the PDF file here:



Get full access to Norbert’s Web Dev School at norbertbmwebdev.substack.com/subscribe

Podden och tillhΓΆrande omslagsbild pΓ₯ den hΓ€r sidan tillhΓΆr Norbert B.M.. InnehΓ₯llet i podden Γ€r skapat av Norbert B.M. och inte av, eller tillsammans med, Poddtoppen.

Senast besΓΆkta

Weekly Code Quickies

React Crash Course 2025 – Build Your First App with Hooks, Components & State!

00:00