Digital Garden

Getting Started with React

A knowledge-style version of the Getting Started with React guide.

Getting Started with React

This article mirrors the companion blog post and provides a concise, reference-friendly version of the Getting Started with React guide.

Quick Start

npm create vite@latest my-react-app -- --template react-ts
cd my-react-app
npm install
npm run dev

Example Component

function Welcome({ name }: { name: string }) {
  return <h1>Hello, {name}!</h1>;
}

export default Welcome;

title: Getting Started with React description: A comprehensive guide to building modern web applications with React. date: 2025-12-15 author: John Doe slug: lol-lol


React has become one of the most popular JavaScript libraries for building user interfaces. In this post, we'll explore the fundamentals and best practices.

Why React?

React offers several advantages:

  • Component-Based Architecture - Build encapsulated components that manage their own state
  • Virtual DOM - Efficient updates and rendering
  • Rich Ecosystem - Extensive libraries and tools
  • Strong Community - Active community and support

Getting Started

First, you'll need to set up your development environment:

npm create vite@latest my-react-app -- --template react-ts
cd my-react-app
npm install
npm run dev

Your First Component

Here's a simple React component:

function Welcome({ name }: { name: string }) {
  return <h1>Hello, {name}!</h1>;
}

export default Welcome;

State Management

React provides hooks for managing state:

import { useState } from "react";

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

  return (
    <div>
      <p>Count: {count}</p>
      <button onClick={() => setCount(count + 1)}>Increment</button>
    </div>
  );
}

Conclusion

React is a powerful tool for building modern web applications. Start with the basics and gradually explore more advanced concepts like context, reducers, and custom hooks.