Programming

Programming

Exploring Various Coding Languages

Programming LanguagesSoftware DevelopmentAlgorithms and Data StructuresSoftware EngineeringWeb and Mobile Programming

مقالات این بخش

Asynchronous Data in React – Simulating API Fetching with useEffect and Promises

In React, data is often fetched asynchronously from external sources. This article demonstrates how to simulate asynchronous data fetching using Promises and useEffect. We start with mock data, introduce a delay to mimic network latency, and manage state updates with useState. This is the first step toward integrating real APIs into React applications.

/persian/article-fa/react-async-data-simulate-api-with-useeffect

Conditional Rendering in React – Displaying Loading and Error States for Asynchronous Data

Conditional rendering in React is a powerful tool for controlling what appears in the UI based on different states. This article explains how to show a “Loading…” message while asynchronous data is being fetched, and how to display an error message if the request fails. Using useState and useEffect, we manage isLoading and isError flags, and render content dynamically using ternary and logical operators.

/persian/article-fa/react-conditional-rendering-loading-error-states

Advanced State Management in React – Using useReducer for Complex Transitions

While useState is ideal for simple state updates, React’s useReducer hook offers a more scalable solution for managing complex state transitions. This article demonstrates how to migrate story-related state from useState to useReducer, handle multiple actions like setting and removing stories, and refactor reducer logic for clarity. It’s a foundational step toward building robust, declarative state logic in React applications.

/persian/article-fa/react-advanced-state-management-with-usereducer

Impossible States in React – Predictable State Management with useReducer

Using multiple useState hooks to manage related states like data, loading, and error can lead to impossible states — combinations that should never occur in a well-designed UI. This article shows how to consolidate related states into a single useReducer hook, enabling predictable transitions and eliminating bugs like simultaneous loading and error indicators. By structuring state as a complex object and dispatching clearly defined actions, we gain control and clarity in asynchronous data flows.

/persian/article-fa/react-impossible-states-predictable-management-with-usereducer

Explicit Data Fetching in React – Controlling API Requests with a Confirmation Button

In the initial implementation, every keystroke in the search field triggered a new API request. This article demonstrates how to shift to explicit data fetching in React, where data is only fetched when the user clicks a confirmation button. By separating the searchTerm and url states, and using useCallback and useEffect, we gain full control over when API requests are sent.

/persian/article-fa/react-explicit-data-fetching-with-confirm-button

Third-Party Libraries in React – Using Axios and Async/Await for Data Fetching

This article explores how to replace the native fetch API with the more stable and feature-rich Axios library for data fetching in React. It also demonstrates how to refactor promise-based code using async/await and try/catch blocks for improved readability and error handling. These techniques enhance compatibility with older browsers, improve testability, and simplify asynchronous logic.

/persian/article-fa/react-third-party-libraries-axios-async-await

Forms in React – Submitting Data with onSubmit and Action in Search Forms

react-forms-Forms are essential in modern applications. This article walks through building a search form in React using input and button elements. First, we use the onSubmit attribute to manage form submission, then introduce the action attribute to align with native HTML behavior. This structure improves accessibility, readability, and prepares the app for future React updates.submit-search-with-onsubmit-and-action

/persian/article-fa/react-forms-submit-search-with-onsubmit-and-action

Installing and Bootstrapping a Next.js Project – Quick Start with TypeScript, Tailwind, and App Router

This article walks you through creating a modern Next.js project using the official create-next-app CLI. With a single command, you can scaffold a project preconfigured with TypeScript, Tailwind CSS, App Router, and Turbopack. We’ll also cover folder structure, TypeScript and ESLint setup, and configuring absolute import aliases for cleaner code.

/persian/article-fa/nextjs-installation-quick-start-typescript-tailwind-router

Project Structure and Organization in Next.js – Routing, Layouts, and File Conventions

This article provides a comprehensive overview of how to structure and organize a Next.js project using the App Router. It covers top-level folders and files, routing conventions, dynamic and nested routes, route groups, metadata files, and best practices for colocating components and utilities. Understanding these conventions helps build scalable, maintainable applications with clear separation of concerns.

/persian/article-fa/nextjs-project-structure-routing-layouts-file-conventions

Organizing Routes and Files in Next.js – Private Folders, Route Groups, and Project Structure

Next.js offers powerful features for organizing routes and files. In this article, we explore private folders for isolating internal logic, route groups for organizing without affecting URLs, and various strategies for structuring your project. These techniques improve clarity, scalability, and flexibility in modern React applications.

/persian/article-fa/nextjs-routing-private-folders-and-project-structure

Layouts and Pages in Next.js – Dynamic Routes, Nested Layouts, and Linking Between Pages

Next.js uses file-based routing to define pages and layouts. This article explains how to create root and nested layouts, dynamic routes, access search parameters, and link between pages using the built-in Link component. It also introduces route props helpers like PageProps and LayoutProps for type-safe data handling across segments.

/persian/article-fa/nextjs-layouts-pages-dynamic-routing-and-linking

Linking and Navigating in Next.js – Server Rendering, Prefetching, Streaming, and Fast Transitions

Next.js provides fast and responsive navigation using server rendering, automatic prefetching, streaming, and client-side transitions. This article explains how navigation works, how to optimize it for dynamic routes and slow networks, and how to use loading.tsx and the Link component to improve user experience.

/persian/article-fa/nextjs-linking-navigation-prefetching-streaming-performance
Programming | دکتر شاهین صیامی