tezvyn:

📱Mobile Dev

Mobile app development across platforms

1323 bites

More in Mobile Dev — page 41

React Native89 sec read

SafeAreaView: Avoid Notches and Status Bars (Deprecated)

SafeAreaView was a component that automatically padded your UI to avoid device notches and system bars. It was a simple way to keep content visible on iOS, but it is now deprecated. The modern approach is to use the `react-native-safe-area-context` library.

WebSockets: A Persistent, Two-Way Connection
React Native2 min read

WebSockets: A Persistent, Two-Way Connection

Think of a WebSocket as a dedicated phone line to a server, keeping the connection open for two-way conversation. It's ideal for real-time features like live chat or streaming stock tickers.

React Native2 min read

GraphQL Mutations: Writing Data to Your Graph

Think of a GraphQL mutation as a remote function call for writing data. Unlike REST, you declare what data you want back from the server in the same operation. Use it for creating, updating, or deleting data, like submitting a form or liking a post.

React Native2 min read

GraphQL: Ask for Exactly What You Need

GraphQL lets clients request exactly the data they need from a single endpoint, avoiding over-fetching. It's ideal for mobile apps, but beware of the N+1 problem where one query can trigger many database lookups on the backend.

AbortController: Stop Fetch Requests You No Longer Need
React Native2 min read

AbortController: Stop Fetch Requests You No Longer Need

An AbortController is a kill switch for network requests. Use it to cancel a `fetch` when a user navigates away. The main footgun is not handling the `AbortError` that `fetch` throws, which can look like a real network failure.

FormData: The Right Way to Upload Files
React Native2 min read

FormData: The Right Way to Upload Files

FormData is your digital envelope for file uploads. It packages files and text into a `multipart/form-data` payload for `fetch`. Use it in React Native to upload images or videos. The footgun: don't set the `Content-Type` header yourself; `fetch` handles it.

React Native2 min read

Axios Interceptors: Middleware for Your API Calls

Axios Interceptors are like middleware for your API calls, letting you globally modify requests before they're sent or responses before they're handled. Use them to inject auth tokens or log activity. The footgun: request interceptors run last-in-first-out.

TanStack Query: Manage Server State, Not Client State
React Native2 min read

TanStack Query: Manage Server State, Not Client State

TanStack Query treats server data as a cache, not local state. It automates fetching, caching, and background updates to keep your React Native app in sync with your backend.

React Native2 min read

Axios: A Simpler Way to Make HTTP Requests

Axios simplifies making network requests by wrapping native browser APIs in a promise-based client. Use it to GET or POST data in any JavaScript app. The main footgun is forgetting requests are asynchronous; you must use `async/await` to get the data.

React Native2 min read

React Native: Making Network Requests with Fetch

fetch is your app's tool for requesting server data. It's asynchronous, returning a promise for a future response. Use it for API calls like loading profiles or posting updates. The footgun: always `catch` errors, or they will fail silently.

Immer: Write Mutable Code for Immutable State
React Native2 min read

Immer: Write Mutable Code for Immutable State

Immer lets you write simple, mutable-style code to produce an immutable next state. It's essential in Redux or with React's useState to avoid complex spread operators for deep updates. The footgun: mutations are only safe inside Immer's `produce` function.

React Native2 min read

Memoized Selectors: Avoid Needless Re-renders

A memoized selector caches its result, re-running only if its inputs from the Redux store change. Use it to compute derived data like a filtered list without triggering needless re-renders.

React Native2 min read

Redux Saga: Managing Side Effects with Generators

Redux Saga runs side effects in a separate thread-like process. It listens for Redux actions and executes complex async tasks, like API calls, keeping that logic out of your components.

React Native2 min read

Redux Middleware: Intercepting Actions Before Reducers

Redux middleware is like an Express middleware for your state, intercepting actions before they hit the reducer. It's used for logging, crash reporting, or async API calls. The footgun is forgetting to call `next(action)`, which silently blocks the action.

Jotai for React Native: Atomic State, Native Performance
React Native2 min read

Jotai for React Native: Atomic State, Native Performance

Jotai brings minimalist, atomic state management to React Native, treating state as small, independent pieces. It's ideal for sharing state without prop drilling and offers full compatibility out of the box, including persistence via `atomWithStorage`.

React Native2 min read

Redux Toolkit: The Opinionated Way to Write Redux

Redux Toolkit (RTK) is the official, opinionated way to write Redux, bundling best practices to eliminate boilerplate. Use it for any new Redux app to simplify store setup and state updates.

React Native2 min read

React Redux: Connecting Components to a Global Store

React Redux connects your React UI to a global Redux state store, letting components read data and dispatch updates. It's used to avoid "prop drilling" shared state across the app.

React Native2 min read

Redux: A Single Source of Truth for App State

Redux centralizes app state into a single "store." Instead of components managing state locally, they dispatch actions to a global reducer. Use it when many components share data.

useReducer: Manage Complex State with Predictable Actions
React Native2 min read

useReducer: Manage Complex State with Predictable Actions

useReducer centralizes complex state logic. Instead of setting state directly, you "dispatch" actions describing what happened. It's ideal for state with many sub-values or when the next state depends on the previous one.

React Context API: Avoid Prop Drilling
React Native2 min read

React Context API: Avoid Prop Drilling

React Context is like a global announcement system for a component tree, letting distant children access data without passing it through every intermediate component. Use it for app-wide state like themes or user authentication.