Tech TutorBangla Web Documentation
Portfolio
HomeHTMLCSSTailwind CSSJavaScriptTypeScriptReactNext.jsNode.jsExpressSocket.IOExpoWordPressPostgreSQLPrismaPostgresNestJSMongoDBDockerTanStackTanStack TableRTK QueryGitGitHub
  • Expo Documentation40টি অধ্যায়
প্রযুক্তি নির্বাচন
HomeHTMLCSSTailwind CSSJavaScriptTypeScriptReactNext.jsNode.jsExpressSocket.IOExpoWordPressPostgreSQLPrismaPostgresNestJSMongoDBDockerTanStackTanStack TableRTK QueryGitGitHub
  • Expo Intro
  • Expo vs React Native
  • RN Basics
  • Environment Setup
  • Project Setup
  • Project Structure
  • App Config
  • Expo Router Intro
  • Stack Navigation
  • Tabs Navigation
  • Core Components
  • Styling & Flexbox
  • Safe Area
  • Scroll & Lists
  • Forms & State
  • AsyncStorage
  • Project: Task Actions
  • Project: Screens
  • Images & Assets
  • Icons & Fonts
  • Theming
  • Camera & Picker
  • Notifications
  • Location & Maps
  • SQLite
  • API & Fetch
  • Loading & Errors
  • Secure Store & Auth
  • Auth Session
  • AppState & Network
  • Performance
  • Debugging & Tests
  • Config & Env
  • Splash & Updates
  • EAS Build
  • EAS Update
  • Store Submission
  • Common Mistakes
  • Best Practices
  • Interview Questions
  1. Docs
  2. Expo
  3. REST API থেকে data — fetch ও POST
ExpoIntermediate

REST API থেকে data — fetch ও POST

নিজের mock API-তে task sync — fetch-এর সঠিক নিয়ম।

4টি অংশবাংলা ভাষায়

সার্ভার-এ task জমা/আনা — native `fetch`-ই যথেষ্ট:

lib/api.tsts
ts
const API_URL = "https://api.example.com";

export async function fetchTasks() {
  const res = await fetch(API_URL + "/tasks");
  if (!res.ok) throw new Error("Fetch failed");
  return await res.json();
}

export async function createTaskOnServer(task) {
  const res = await fetch(API_URL + "/tasks", {
    method: "POST",
    headers: { "Content-Type": "application/json" },
    body: JSON.stringify(task),
  });
  if (!res.ok) throw new Error("Create failed");
  return await res.json();
}
  • res.ok check — 2xx-এর বাইরে error throw
  • timeout — AbortController দিয়ে
  • network error — catch-এ দেখান
localhost ভুলবে না

ফিজিক্যাল ফোনে localhost মানে ফোন নিজেই — আপনার কম্পিউটারের LAN IP (http://192.168.x.x:3000) ব্যবহার করুন; Android emulator-এ 10.0.2.2।

শেষ প্যারায় নিজে practice করুন — কোড কপি করে নিজের এডিটরে চালিয়ে দেখুন।
আগেরexpo-sqlite — local SQL databaseপরেরLoading, error ও retry state
Tech Tutor

বাংলায় ওয়েব ডেভেলপমেন্ট ডকুমেন্টেশন শিখুন — ধাপে ধাপে।

Homeসব ডকুমেন্টেশনQuick Startআমার নোটস

© 2026 Tech Tutor. বাংলায় শিখুন, বাংলায় গড়ুন।

mdanamolhasan1998@gmail.com