<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Mrinal Maheshwari</title>
    <description>The latest articles on DEV Community by Mrinal Maheshwari (@maheshwarimrinal).</description>
    <link>https://dev.to/maheshwarimrinal</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1024889%2Ffcfad332-07fe-4812-b8e1-93b6efbdcc8a.JPG</url>
      <title>DEV Community: Mrinal Maheshwari</title>
      <link>https://dev.to/maheshwarimrinal</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/maheshwarimrinal"/>
    <language>en</language>
    <item>
      <title>React Native + Android’s 16 KB Page Size: What It Is, Why It Matters, and Exactly How to Get Your App Ready</title>
      <dc:creator>Mrinal Maheshwari</dc:creator>
      <pubDate>Wed, 17 Sep 2025 18:10:19 +0000</pubDate>
      <link>https://dev.to/maheshwarimrinal/react-native-androids-16-kb-page-size-what-it-is-why-it-matters-and-exactly-how-to-get-your-34da</link>
      <guid>https://dev.to/maheshwarimrinal/react-native-androids-16-kb-page-size-what-it-is-why-it-matters-and-exactly-how-to-get-your-34da</guid>
      <description>&lt;h2&gt;
  
  
  Everything you need to know about React Native and Android’s shift to 16KB memory pages — performance boosts, migration steps, and Play Store rules.
&lt;/h2&gt;

&lt;p&gt;If you ship React Native apps to Android, there’s a platform shift you can’t ignore: Android 15 introduces support for 16 KB memory page size. This brings measurable performance wins, but it also means some apps — especially those bundling native code (NDK/C/C++) — must be rebuilt or they won’t run on future 16 KB devices. The React Native team already added support in v0.77, so you’ve got a clear path. Let’s make sure you’re set up end-to-end.&lt;/p&gt;

&lt;p&gt;Google has also tied this to a Play publishing rule: starting November 1, 2025, any new app or update targeting Android 15+ must support 16 KB pages. Don’t wait for the deadline — do the checks now and sleep better.&lt;/p&gt;

&lt;h2&gt;
  
  
  TL;DR for busy React Native devs
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Upgrade React Native to 0.77+ (which explicitly calls out 16 KB support).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Upgrade AGP to 8.5.1 or higher (needed for proper 16 KB zip alignment of uncompressed libs).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Use NDK r27+ (prefer r28+ where 16 KB alignment is default). Otherwise, add the linker flags shown below.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Rebuild all native bits (yours and any SDKs shipping .so files). Pure Kotlin/Java apps are usually fine, but still test.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Test in a 16 KB environment (emulator or eligible Pixel). Verify with&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;adb shell getconf PAGE_SIZE → 16384.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Check Play Console &amp;gt; App Bundle Explorer for 16 KB compliance warnings.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  What “page size” means (and why 16 KB helps)
&lt;/h2&gt;

&lt;p&gt;Android (like every OS) manages memory in fixed-size “pages.” Historically that was 4 KB; Android 15 supports 16 KB pages on newer devices. Larger pages mean fewer address translations → less overhead → faster launches (3% on average, up to 30% in some cases), lower power draw, quicker camera starts, and even faster boot. Expect a small increase in memory use, but the overall experience improves.&lt;/p&gt;

&lt;h2&gt;
  
  
  How this affects React Native specifically
&lt;/h2&gt;

&lt;p&gt;The React Native 0.77 release explicitly mentions Android 15 support &amp;amp; 16 KB page support. In practice:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;If your app (or any dependency) includes NDK/C++ code, you must rebuild with 16 KB-compatible toolchains/flags.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Popular SDKs are updating; keep an eye on your dependency tree and update to their 16 KB–ready versions.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  A practical migration plan (copy/paste friendly)
&lt;/h2&gt;

&lt;h2&gt;
  
  
  1) Bump your stack
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;React Native: 0.77 or newer.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Android Gradle Plugin (AGP): 8.5.1+. This ensures uncompressed shared libraries are aligned to a 16 KB zip boundary.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;In your project’s gradle.properties / build.gradle versions matrix, target AGP ≥ 8.5.1.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;NDK:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;r28+ → 16 KB alignment by default (no extra flags).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;r27 → enable flexible page sizes (flags below).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;r26 or lower → add linker flags; for very old NDKs (≤ r22) there’s an extra common-page-size flag. Prefer upgrading.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  2) Enable 16 KB alignment for native code (only if needed)
&lt;/h2&gt;

&lt;p&gt;CMake (Gradle externalNativeBuild)&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# CMakeLists.txt
target_link_options(${CMAKE_PROJECT_NAME} PRIVATE "-Wl,-z,max-page-size=16384")
# If you’re stuck on very old NDKs (≤ r22):
# target_link_options(${CMAKE_PROJECT_NAME} PRIVATE "-Wl,-z,common-page-size=16384")
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Gradle (CMake arguments) with NDK r27&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;android {
  defaultConfig {
    externalNativeBuild {
      cmake {
        arguments += listOf("-DANDROID_SUPPORT_FLEXIBLE_PAGE_SIZES=ON")
      }
    }
  }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;ndk-build&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Application.mk (NDK r27)
APP_SUPPORT_FLEXIBLE_PAGE_SIZES := true

# Android.mk (NDK r26 or lower)
LOCAL_LDFLAGS += "-Wl,-z,max-page-size=16384"
# For ≤ r22 also add:
# LOCAL_LDFLAGS += "-Wl,-z,common-page-size=16384"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;These snippets reflect the official guidance for different NDK versions.&lt;/p&gt;

&lt;h2&gt;
  
  
  3) Don’t rely on PAGE_SIZE = 4096
&lt;/h2&gt;

&lt;p&gt;Search your native code (and any forks) for places that assume 4 KB (e.g., usage of PAGE_SIZE or hardcoded 4096). Replace with getpagesize() / sysconf(_SC_PAGESIZE), or refactor logic so it doesn’t depend on a fixed page size. Newer NDKs even undefine PAGE_SIZE in 16 KB mode to avoid misuse.&lt;/p&gt;

&lt;h2&gt;
  
  
  4) Align packaging and verify
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;With AGP 8.5.1+, uncompressed .so files are zip-aligned to 16 KB automatically.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Verify alignment on your built APK/AAB:&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;zipalign -c -P 16 -v 4 app-release.apk
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You’re looking for a clean pass — no misaligned native libs.&lt;/p&gt;

&lt;h2&gt;
  
  
  5) Test in a real 16 KB environment
&lt;/h2&gt;

&lt;p&gt;Options (pick one or more):&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Android Emulator with a 16 KB Android 15 system image.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Eligible Pixel devices via “Boot with 16KB page size” developer option (Pixel 8/8a/9 family on Android 15 QPR builds).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Samsung Remote Test Lab on supported devices.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Confirm the environment:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;adb shell getconf PAGE_SIZE
# Expect: 16384
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then run your full regression suite.&lt;/p&gt;

&lt;h2&gt;
  
  
  How to know if your app is actually impacted
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;If your app is pure Kotlin/Java with no native code anywhere (including SDKs), you’re likely already compatible; still test on 16 KB to be safe.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;If you use React Native libraries that include native code (e.g., image processing, media, crypto, maps, analytics, etc.), you need to update those SDKs to 16 KB–ready builds and rebuild your app. The Play Console’s App Bundle Explorer highlights compliance issues.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Deadlines (pin these)
&lt;/h2&gt;

&lt;p&gt;November 1, 2025 — Google Play requires all new apps and updates targeting Android 15+ to support 16 KB pages. If you miss this, your submission can be blocked.&lt;/p&gt;

&lt;h2&gt;
  
  
  Example: a typical React Native Android upgrade checklist
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Upgrade React Native to 0.77 (or newer).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Upgrade AGP to 8.5.1+ and Gradle accordingly.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Update NDK to r28+ (best), otherwise apply the linker flags above.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Update all native SDKs in android/app/build.gradle and your package.json → run a full, clean rebuild.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Re-run ProGuard/R8 and ensure no native libs are stripped incorrectly.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Test on emulator/device running 16 KB mode → verify with getconf.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Check App Bundle Explorer for alignment and compatibility.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Troubleshooting: common “gotchas” I see
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;“App won’t install on a 16 KB device” → usually means one or more .so files are mis-aligned or still 4 KB-assumed. Re-check NDK version and flags; re — zipalign.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;“Crash in native lib at startup” → grep for hardcoded 4096 or PAGE_SIZE. Replace with getpagesize() or remove the dependency.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;“Third-party SDK not updated” → upgrade the SDK; if no update exists, contact the vendor or consider replacing it. The Play blog specifically calls out that many major stacks (including React Native) already provide compatible releases.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;“CI builds okay, emulator still shows 4096” → you’re not booted into a 16 KB image/mode. Re-download the 16 KB emulator image or enable the device developer toggle, then re-check getconf.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Why you should do this now (not the week before Nov 1)
&lt;/h2&gt;

&lt;p&gt;Beyond the Play rule, the perf wins are real: faster launches (avg ~3%, up to 30%), lower power draw (≈4.5%), quicker camera starts, and faster boot. These are platform-level gains that make your app feel snappier with zero feature work — once you rebuild correctly.&lt;/p&gt;

&lt;h2&gt;
  
  
  Handy references (keep these open)
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Android practice guide: Support 16 KB page sizes — the canonical “how-to” with AGP/NDK specifics, flags, and testing steps.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;React Native 0.77 release notes — confirms 16 KB support and Android 15 readiness.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Android Developers Blog (Play requirement) — dates, rationale, performance numbers, and Console guidance.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Android source docs (deeper system details about 16 KB ELF alignment, kernels, and product flags).&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Final thoughts
&lt;/h2&gt;

&lt;p&gt;This isn’t a “nice to have.” It’s the memory model your next wave of Android devices will use. The good news: React Native 0.77+ plus a modern AGP/NDK stack makes the migration pretty painless. Update, rebuild, test in 16 KB, and you’re done.&lt;/p&gt;

&lt;p&gt;If you hit a weird edge case — especially around older NDKs or legacy SDKs — start by upgrading toolchains, then check alignment and any assumptions about PAGE_SIZE.&lt;/p&gt;

&lt;p&gt;Happy shipping — and faster launches ✨&lt;/p&gt;

&lt;p&gt;If this helped, you can &lt;a href="https://buymeacoffee.com/maheshwarimrinal" rel="noopener noreferrer"&gt;Buy me a coffee ☕&lt;/a&gt;&lt;/p&gt;

</description>
      <category>reactnative</category>
      <category>android</category>
      <category>16kbpagesize</category>
      <category>mobile</category>
    </item>
    <item>
      <title>🧠 How to Code Review Without Losing Your Mind (or Your Team’s Respect)</title>
      <dc:creator>Mrinal Maheshwari</dc:creator>
      <pubDate>Mon, 28 Jul 2025 15:44:04 +0000</pubDate>
      <link>https://dev.to/maheshwarimrinal/how-to-code-review-without-losing-your-mind-or-your-teams-respect-j4m</link>
      <guid>https://dev.to/maheshwarimrinal/how-to-code-review-without-losing-your-mind-or-your-teams-respect-j4m</guid>
      <description>&lt;h2&gt;
  
  
  A no-nonsense guide to giving and receiving feedback that actually helps
&lt;/h2&gt;

&lt;h2&gt;
  
  
  👀 Why Code Reviews Matter
&lt;/h2&gt;

&lt;p&gt;Code reviews are more than just nitpicking tabs vs. spaces. They’re about sharing knowledge, improving quality, and building trust. Whether you’re a fresh hire or the architect, the moment you click “Request Review,” you’re inviting someone into your thought process.&lt;/p&gt;

&lt;p&gt;And when you’re the reviewer? You’re stepping into the code’s story, trying to understand not just what it does — but whyit was written that way.&lt;/p&gt;

&lt;p&gt;Done right, code reviews elevate the whole team. Done wrong, they frustrate everyone and ship bugs.&lt;/p&gt;

&lt;h2&gt;
  
  
  🎯 The Goal of a Code Review Is Not Perfection
&lt;/h2&gt;

&lt;p&gt;Let’s get one thing straight: your job as a reviewer is not to rewrite the code. It’s to improve it.&lt;/p&gt;

&lt;p&gt;You’re looking for:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Correctness: Does it work as intended? Could it break something else?&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Clarity: Can someone else understand this six months later?&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Consistency: Does it follow project conventions?&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Scalability: Will it still work when more users or data are added?&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Security: Are there any obvious vulnerabilities or edge cases?&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;✅ Example (Clarity):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// Less clear
const a = b * c - d;
// Better
const finalPrice = discount * quantity - couponValue;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;✅ Example (Consistency):&lt;/p&gt;

&lt;p&gt;If your team uses camelCase for function names:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// Inconsistent
function fetch_user_data() {}
// Consistent
function fetchUserData() {}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  👂 Read the Code Before You Judge
&lt;/h2&gt;

&lt;p&gt;Slow down. Don’t skim the diff and start commenting like you’re on Twitter. First, try to understand the problem the code is solving.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Read the PR description.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Check the related ticket or task.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Skim the changes as a whole before going line by line.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If the “why” isn’t obvious, ask. Clarification &amp;gt; Assumption.&lt;/p&gt;

&lt;h2&gt;
  
  
  💬 Feedback Isn’t War — It’s a Conversation
&lt;/h2&gt;

&lt;p&gt;You’re not a linter. You’re a teammate.&lt;/p&gt;

&lt;p&gt;Use neutral language:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Instead of: “This is wrong.”&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Try: “Can you help me understand why this approach was taken?”&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Use suggestions, not commands:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;“Consider renaming this for clarity.”&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;“Would using a loop here improve readability?”&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Don’t forget to praise good work:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;“Nice use of forEach loop here.”&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;“Great job simplifying the logic!”&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  🧠 For the Reviewer: Be Kind, Be Curious, Be Clear
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;🧪 Test Locally if You Can: Don’t just rely on static diff views.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;🧼 Review in Chunks: Don’t try to go through 500 lines at once.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;📅 Review Promptly: A slow review delays everyone. Be respectful of people’s timelines.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;🤔 Think Contextually: Don’t overcorrect. Some imperfections are okay if they don’t harm the outcome.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;✅ Example (Security):&lt;/p&gt;

&lt;p&gt;If you see this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;fetch(`https://api.example.com/user/${userId}`)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;…ask if the API endpoint needs to be sanitized or authenticated. Even general codebases can leak private info if unchecked.&lt;/p&gt;

&lt;h2&gt;
  
  
  🙇 For the Author: Feedback Is a Gift (Yes, Really)
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Don’t take it personally. Your code ≠ your worth.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Respond with openness: “Thanks for the catch!” goes a long way.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;If you disagree, explain respectfully. Defending a decision is part of the collaboration process.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;And always say thank you. They took time to review your work.&lt;/p&gt;

&lt;h2&gt;
  
  
  🧩 Tips for Teams to Make Code Reviews Smoother
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;✅ Define what must be reviewed (e.g. new features, infra changes).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;🧾 Have a checklist (e.g. test cases, naming, error handling).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;🧠 Keep PRs small. Big ones invite procrastination.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;💬 Use PR templates to give context.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;🙌 Encourage pair reviews occasionally — especially for juniors.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;⏳ Timebox feedback sessions to avoid burnouts.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  🛠️ Code Reviews Are Culture
&lt;/h2&gt;

&lt;p&gt;More than a practice, code reviews reflect the culture of your team:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Is it safe to ask questions?&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Are juniors encouraged to review?&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Is feedback appreciated, or feared?&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Great codebases come from great code review habits. And great habits come from teams that value respect, collaboration, and clarity.&lt;/p&gt;

&lt;h2&gt;
  
  
  👋 Coming Soon…
&lt;/h2&gt;

&lt;p&gt;Love working with React Native? I’m writing a dedicated React Native Code Review Guide — from optimizing renders to catching native quirks before they hit production.&lt;/p&gt;

&lt;p&gt;Stay tuned.&lt;/p&gt;

&lt;h2&gt;
  
  
  ☕ Enjoyed this piece?
&lt;/h2&gt;

&lt;p&gt;I write about team culture, software engineering, and dev life. If this helped you, consider buying me a coffee so I can keep writing honest, practical blogs.&lt;/p&gt;

</description>
      <category>codereview</category>
      <category>programming</category>
      <category>developerproductivity</category>
      <category>codequality</category>
    </item>
    <item>
      <title>How to Improve API Performance: Tips, Techniques &amp; Best Practices</title>
      <dc:creator>Mrinal Maheshwari</dc:creator>
      <pubDate>Sun, 15 Jun 2025 03:30:00 +0000</pubDate>
      <link>https://dev.to/maheshwarimrinal/how-to-improve-api-performance-tips-techniques-best-practices-4d1a</link>
      <guid>https://dev.to/maheshwarimrinal/how-to-improve-api-performance-tips-techniques-best-practices-4d1a</guid>
      <description>&lt;p&gt;“APIs have been a real pain point for me. Even after delivering the product and pushing it to production, the APIs didn’t perform as expected. What should ideally take less than a second often ends up taking 4–5 seconds — and that’s frustrating, both as a developer and a user.”&lt;/p&gt;

&lt;p&gt;I’ve been in that situation more than once — staring at network logs, wondering why a seemingly simple endpoint is taking ages to respond. After a lot of debugging, Googling, and diving into books on algorithms and software architecture, I started identifying patterns. Eventually, I collated a list of practical techniques that genuinely helped improve API performance.&lt;/p&gt;

&lt;p&gt;In this article, I’m sharing those learnings — 15 real-world strategies that have worked for me across different projects. Whether you’re trying to fix a slow endpoint or just build more scalable APIs from day one, I hope these insights help you save time and headaches.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Optimize Database Access
&lt;/h2&gt;

&lt;p&gt;Why it matters: Your API is only as fast as the database queries behind it.&lt;/p&gt;

&lt;p&gt;How to implement:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Use indexes on frequently queried columns.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Avoid N+1 query problems (where fetching related records causes repeated database calls).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;In Sequelize: use .include to load relationships.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;In Prisma: use include to fetch relations in a single query.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Batch requests using IN clauses or union queries when possible.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Real life: If you’re querying user orders, fetch them with a single join rather than looping through user IDs and hitting the DB repeatedly.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Use Efficient Data Formats
&lt;/h2&gt;

&lt;p&gt;Why it matters: Data serialization and size directly affect response time.&lt;/p&gt;

&lt;p&gt;Alternatives to JSON:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Protocol Buffers (Protobuf): Small, fast, and language-neutral (commonly used with gRPC).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;MessagePack: Binary format, compatible with many languages and frameworks.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;When to use:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Use JSON for public or third-party APIs.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Use Protobuf or MessagePack in internal microservices for performance gains.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  3. Reduce Payload Size
&lt;/h2&gt;

&lt;p&gt;Why it matters: Every extra byte adds to the transfer time and processing load.&lt;/p&gt;

&lt;p&gt;How to implement:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Only send required fields using field selection or select.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Avoid deeply nested JSON if not necessary.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Trim strings (no need to send 500-character bios in a list view).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Don’t return large blobs (e.g., images, files) directly — use URLs or S3 links.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  4. Enable Compression
&lt;/h2&gt;

&lt;p&gt;Why it matters: You can reduce response size by up to 90%.&lt;/p&gt;

&lt;p&gt;How to implement:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;In Express.js, use the compression middleware:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const compression = require('compression');
app.use(compression());
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;In NGINX:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;gzip on;
gzip_types text/plain application/json;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Tip: Use Brotli for better compression than GZIP if your infra supports it.&lt;/p&gt;

&lt;h2&gt;
  
  
  5. Caching Strategies
&lt;/h2&gt;

&lt;p&gt;Why it matters: Why calculate or fetch the same data again and again?&lt;/p&gt;

&lt;p&gt;Caching layers:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Browser/Client: Use Cache-Control, ETag, and Last-Modified headers.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;CDN: Use Cloudflare, Fastly, or AWS CloudFront to cache static responses.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Application: Cache DB queries or computed data using Redis.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Database: Materialized views or result cache.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  6. Use Pagination &amp;amp; Filtering
&lt;/h2&gt;

&lt;p&gt;Why it matters: Large data dumps kill bandwidth and frontend performance.&lt;/p&gt;

&lt;p&gt;How to implement:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Add limit, offset, or cursor-based pagination.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Filter data server-side using query parameters (?status=active&amp;amp;type=premium).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Use fields query to return only requested fields.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Example (REST):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;GET /users?limit=10&amp;amp;offset=20
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Example (GraphQL):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;query {
  users(first: 10, after: "cursor") {
    name
    email
  }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  7. Asynchronous Processing
&lt;/h2&gt;

&lt;p&gt;Why it matters: Long-running operations (e.g., image processing, email sending) should not block the response.&lt;/p&gt;

&lt;p&gt;What to do:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Offload tasks to a queue: RabbitMQ, Redis, Kafka, or SQS.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Respond immediately with 202 Accepted.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Use webhooks, push notifications, or polling to notify clients when processing is complete.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Real world example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// Enqueue job for PDF generation
await queue.add('generate-pdf', { userId: 123 });
res.status(202).json({ message: "Processing started" });
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  8. Connection Management
&lt;/h2&gt;

&lt;p&gt;Why it matters: Poor connection handling leads to leaks, bottlenecks, and eventual crashes.&lt;/p&gt;

&lt;p&gt;Tips:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Use keep-alive to avoid reconnecting repeatedly.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Enable connection pooling with DBs.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Set timeouts for DB, HTTP, and external APIs.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Example (PostgreSQL + pg-pool):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const pool = new Pool({
  max: 20,
  idleTimeoutMillis: 30000,
  connectionTimeoutMillis: 2000,
});
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  9. Load Balancing
&lt;/h2&gt;

&lt;p&gt;Why it matters: Distributes traffic, avoids server overload, improves uptime.&lt;/p&gt;

&lt;p&gt;What you can use:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;NGINX or HAProxy for simple round-robin or least-connections strategies.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Cloud providers (AWS ELB, GCP Load Balancer) for auto-scaling and health checks.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Use sticky sessions only if absolutely necessary.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  10. Rate Limiting &amp;amp; Throttling
&lt;/h2&gt;

&lt;p&gt;Why it matters: Protects your API from abuse and ensures fair usage.&lt;/p&gt;

&lt;p&gt;How to do it:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Limit by IP, user ID, or API key.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Use sliding window or token bucket algorithms.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Return 429 Too Many Requests with a retry-after header.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Example (Express):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const rateLimit = require("express-rate-limit");
app.use(rateLimit({ windowMs: 60000, max: 100 }));
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  11. HTTP/2 or gRPC
&lt;/h2&gt;

&lt;p&gt;Why it matters: More efficient protocol = faster response times.&lt;/p&gt;

&lt;p&gt;Benefits of HTTP/2:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Multiplexing multiple requests over one connection.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Header compression.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Faster loading for clients making many requests.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;gRPC advantages:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Uses Protobuf, extremely fast and compact.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Ideal for internal APIs, microservices.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Supports client-side codegen.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Setup: Use Envoy or NGINX as HTTP/2 proxy, or gRPC with Node, Go, Java.&lt;/p&gt;

&lt;h2&gt;
  
  
  12. Use CDN for Static Assets
&lt;/h2&gt;

&lt;p&gt;Why it matters: Don’t make your server serve files — push them to the edge.&lt;/p&gt;

&lt;p&gt;What to serve via CDN:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Images&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;PDF files&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;JS/CSS bundles&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Videos&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Tools: Cloudflare, AWS CloudFront, Vercel Edge, Netlify&lt;/p&gt;

&lt;p&gt;Bonus tip: Use signed URLs for protected file downloads.&lt;/p&gt;

&lt;h2&gt;
  
  
  13. Optimize Server Code
&lt;/h2&gt;

&lt;p&gt;Why it matters: Even fast APIs break if backend logic is inefficient.&lt;/p&gt;

&lt;p&gt;Tips:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Avoid blocking operations (e.g., fs.readFileSync, long loops).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Use asynchronous patterns (async/await, Promise.all).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Profile your app using Node.js built-in profiler or tools like clinic.js.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  14. Monitoring &amp;amp; Profiling
&lt;/h2&gt;

&lt;p&gt;Why it matters: You can’t fix what you don’t measure.&lt;/p&gt;

&lt;p&gt;Track:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Latency (average, P95, P99)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Error rates&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Slow endpoints&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Memory usage&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Tools:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;APM: Datadog, New Relic, Dynatrace&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Logging: Winston, Pino, ELK Stack&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Tracing: OpenTelemetry + Jaeger&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  15. Secure Without Bottlenecks
&lt;/h2&gt;

&lt;p&gt;Why it matters: Don’t compromise speed for security, or vice versa.&lt;/p&gt;

&lt;p&gt;How:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Validate JWTs efficiently using in-memory public keys.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Use lightweight middlewares for token validation.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Don’t do heavy DB lookups before authentication.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Final Thoughts
&lt;/h2&gt;

&lt;p&gt;Improving API performance is a continuous process. Start by measuring, then fix the biggest pain points first. Whether you’re working with REST, GraphQL, or gRPC — these techniques are universal.&lt;/p&gt;

&lt;p&gt;By applying even a handful of these best practices, you’ll create faster, more scalable, and user-friendly APIs.&lt;/p&gt;

</description>
      <category>backenddevelopment</category>
      <category>performance</category>
      <category>webperf</category>
      <category>backend</category>
    </item>
    <item>
      <title>🚀 Boosting React Native Performance with Caching — Made Simple</title>
      <dc:creator>Mrinal Maheshwari</dc:creator>
      <pubDate>Fri, 13 Jun 2025 03:30:00 +0000</pubDate>
      <link>https://dev.to/maheshwarimrinal/boosting-react-native-performance-with-caching-made-simple-359a</link>
      <guid>https://dev.to/maheshwarimrinal/boosting-react-native-performance-with-caching-made-simple-359a</guid>
      <description>&lt;p&gt;In this guide, we’ll break down what caching is, why it matters in React Native, and how to implement it with some handy tools and libraries.&lt;/p&gt;

&lt;h2&gt;
  
  
  🔍 Why Should You Care About Caching?
&lt;/h2&gt;

&lt;p&gt;Mobile apps run on devices that have limited memory and storage — and let’s be honest, internet connections aren’t always reliable. Caching helps your app:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Load faster by avoiding repeated API calls&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Work offline or in poor network conditions&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Feel smoother by loading images and data locally&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  🧰 Types of Caching in React Native
&lt;/h2&gt;

&lt;p&gt;Not all caching is created equal. Let’s look at the most useful types:&lt;/p&gt;

&lt;h3&gt;
  
  
  1. In-Memory Caching
&lt;/h3&gt;

&lt;p&gt;This is the quickest way to cache data, storing it temporarily in the app’s memory.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Great for UI state or short-lived data&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Libraries like Redux, Zustand, or React’s Context API can handle this&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;But remember: once the app closes, this data is gone&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  2. Persistent Caching
&lt;/h3&gt;

&lt;p&gt;This is for data that should stick around, even after restarting the app.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Useful for login tokens, user settings, or cached API responses&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Use tools like AsyncStorage or the faster, more secure MMKV&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Keeps your app functional even without an internet connection&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  3. Image Caching
&lt;/h3&gt;

&lt;p&gt;React Native doesn’t cache images well by default, which can cause slow load times and unnecessary data use.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Use react-native-fast-image for proper image caching and better performance&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Especially useful for apps with lots of images (e.g. shopping, social media)&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  4. API Response Caching
&lt;/h3&gt;

&lt;p&gt;Instead of hitting the server every time, cache API responses locally.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Helps reduce load on your backend&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Makes screens load quicker&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Tools like MMKV, React Query, or SWR can help manage this&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Built-in support for stale data and revalidation&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  🔐 MMKV for Fast Persistent Caching
&lt;/h2&gt;

&lt;p&gt;MMKV is a high-performance storage solution that’s great for caching data on the device.&lt;/p&gt;

&lt;h3&gt;
  
  
  📦 Install MMKV
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm install react-native-mmkv
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  ⚙️ Setup MMKV
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// storage.ts
import { MMKV } from 'react-native-mmkv'
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;export const storage = new MMKV()

export const setCache = (key: string, value: any) =&amp;gt; {
  storage.set(key, JSON.stringify(value))
}

export const getCache = (key: string) =&amp;gt; {
  const json = storage.getString(key)
  return json ? JSON.parse(json) : null
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  🔁 Caching API Responses
&lt;/h2&gt;

&lt;p&gt;Let’s create a simple hook to fetch data and cache it using MMKV.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// useCachedFetch.ts
import { useEffect, useState } from 'react'
import axios from 'axios'
import { getCache, setCache } from './storage'
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;export const useCachedFetch = (url: string, cacheKey: string) =&amp;gt; {
  const [data, setData] = useState&amp;lt;any&amp;gt;(null)
  const [loading, setLoading] = useState(true)
  useEffect(() =&amp;gt; {
    const fetchData = async () =&amp;gt; {
      const cached = getCache(cacheKey)
      if (cached) {
        setData(cached)
        setLoading(false)
        return
      }
      try {
        const response = await axios.get(url)
        setData(response.data)
        setCache(cacheKey, response.data)
      } catch (e) {
        console.error(e)
      } finally {
        setLoading(false)
      }
    }
    fetchData()
  }, [url])
  return { data, loading }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  🧪 Usage
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const { data, loading } = useCachedFetch('https://api.example.com/products', 'products')
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;if (loading) return &amp;lt;ActivityIndicator /&amp;gt;
return (
  &amp;lt;FlatList
    data={data}
    renderItem={({ item }) =&amp;gt; &amp;lt;Text&amp;gt;{item.name}&amp;lt;/Text&amp;gt;}
  /&amp;gt;
)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  🖼️ Image Caching with react-native-fast-image
&lt;/h2&gt;

&lt;p&gt;For static images or images fetched over the network, use react-native-fast-image to enable caching and performance boosts.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm install react-native-fast-image
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import FastImage from 'react-native-fast-image'
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;FastImage
  style={{ width: 100, height: 100 }}
  source={{
    uri: 'https://example.com/image.jpg',
    priority: FastImage.priority.normal,
    cache: FastImage.cacheControl.immutable,
  }}
/&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  ⚠️ Gotchas &amp;amp; Best Practices
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Set a TTL (Time To Live) if the data can go stale&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Don’t store sensitive info unless it’s encrypted&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Clear cache when the user logs out or when data becomes irrelevant&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  📌 Conclusion
&lt;/h2&gt;

&lt;p&gt;Caching is a simple but powerful way to make your React Native app feel lightning fast and reliable. With tools like MMKV and FastImage, you can easily implement smart caching strategies that keep users happy — even when their internet isn’t.&lt;/p&gt;

&lt;p&gt;Happy Caching! 💙&lt;/p&gt;

&lt;h2&gt;
  
  
  ❓Got Questions or Thoughts?
&lt;/h2&gt;

&lt;p&gt;Here are a few things to think about (or ask your team):&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;What kind of data in your app could benefit the most from caching?&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Are you currently using in-memory or persistent caching — or both?&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;How are you handling cache invalidation or stale data?&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Are your current caching methods optimized for performance and security?&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Could your app offer a better offline experience with smarter caching?&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Feel free to share your caching strategies or challenges. Let’s learn from each other!&lt;/p&gt;

</description>
      <category>reactnative</category>
      <category>caching</category>
      <category>database</category>
      <category>applicationperformance</category>
    </item>
    <item>
      <title>React Native Interview Deep Dive: 9 Questions That Reveal What Resumes Don’t</title>
      <dc:creator>Mrinal Maheshwari</dc:creator>
      <pubDate>Thu, 12 Jun 2025 19:50:26 +0000</pubDate>
      <link>https://dev.to/maheshwarimrinal/react-native-interview-deep-dive-9-questions-that-reveal-what-resumes-dont-2li</link>
      <guid>https://dev.to/maheshwarimrinal/react-native-interview-deep-dive-9-questions-that-reveal-what-resumes-dont-2li</guid>
      <description>&lt;h2&gt;
  
  
  Q1. Have you used Class based components or functional components ?
&lt;/h2&gt;

&lt;p&gt;is designed to gauge a candidate’s familiarity with different generations of React development. It helps me understand how long the candidate has been working with React &amp;amp; React Native, whether they’ve adapted to modern best practices (like hooks), and if they can maintain legacy codebases. Class-based components were standard before React 16.8, while functional components with hooks represent the modern approach. A well-rounded candidate typically has experience with both and can articulate the differences in lifecycle management, state handling, and code structure.&lt;/p&gt;

&lt;p&gt;If developer goes as:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;“Only class components” → Experience with legacy React, may need to learn hooks and functional patterns.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;“Only functional components” → Likely newer to React, started after hooks were introduced.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;“Both, but prefer functional” → Versatile and up-to-date with modern React practices.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Q2. How can you secure your mobile application data, be the data is in transit or rest ?
&lt;/h2&gt;

&lt;p&gt;assesses a candidate’s understanding of mobile app security fundamentals. It evaluates their knowledge of securing sensitive information both while it’s being transmitted over networks (in transit) and when stored locally on the device (at rest). A strong answer would cover the use of HTTPS (TLS) for secure communication, SSL pinning to prevent man-in-the-middle attacks, and secure storage solutions like Keychain (iOS), Keystore (Android), or libraries like react-native-mmkv or react-native-keychain for encrypting data on the device. It also hints at the candidate’s awareness of compliance, data protection best practices, and their ability to build trustworthy, enterprise-grade applications.&lt;/p&gt;

&lt;p&gt;If developer&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Mentions HTTPS only → Basic awareness; needs more depth in securing data.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Includes SSL pinning and secure storage → Good understanding of both in-transit and at-rest protection.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Mentions encryption, platform APIs (Keychain/Keystore) → Strong grasp of mobile security and platform-specific practices.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Includes token handling, data minimization → Advanced level, with security-by-design mindset.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Q3. Have you worked with Typescript or JavaScript ?
&lt;/h2&gt;

&lt;p&gt;helps assess a candidate’s proficiency with the core languages used in React Native development. It distinguishes whether the candidate has experience with JavaScript, the foundational scripting language, or TypeScript, the typed superset that adds static typing and better tooling. TypeScript is widely adopted in modern codebases for its scalability, maintainability, and early error detection. A candidate who has worked with both shows adaptability and a deeper understanding of development quality and tooling. The answer also indicates how comfortable the candidate is with types, interfaces, and advanced language features used in large-scale or enterprise-level applications.&lt;/p&gt;

&lt;p&gt;Evaluation goes where he answers:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;“Only JavaScript” → Basic familiarity, suitable for simpler apps or junior roles.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;“Only TypeScript” → Likely has experience in more modern or enterprise projects.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;“Both, prefer TypeScript” → Ideal candidate; adaptable with best practice knowledge.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;“Both, but still learning TypeScript” → In transition, shows willingness to adopt modern tools.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Q4. Can’t perform a React state update on an unmounted component, what does this error/warning state ?
&lt;/h2&gt;

&lt;p&gt;occurs when your code tries to update the state of a component after it has already been removed from the UI tree (unmounted). This typically happens when an asynchronous operation like a fetch, setTimeout, or subscription completes after the component has unmounted, leading to a memory leak or unnecessary state update. React throws this warning to help developers avoid side effects or crashes from manipulating non-existent components. Proper cleanup using useEffect’s return function or tracking component mount status can prevent this issue.&lt;/p&gt;

&lt;p&gt;My interpretation goes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;“Not sure what it means” → Lacks experience with async operations or lifecycle management.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;“It’s about updating state after unmount” → Has encountered and understood the issue.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;“Mentions cleanup with useEffect” → Good grasp of React lifecycle and hook usage.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;“Implements abort controllers or refs to check mounted status” → Advanced handling and prevention skills.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Q5. Have you worked with RestAPIs or graphAPIs as well, and which library or method you’ve used to call APIs ?
&lt;/h2&gt;

&lt;p&gt;is designed to evaluate a candidate’s experience with backend communication, data fetching strategies, and tooling preferences. It helps assess whether the candidate has worked with traditional RESTful APIs or GraphQL, which is more flexible but requires schema understanding. Additionally, asking about the method or library (like fetch, axios, Apollo Client, etc.) reveals their hands-on familiarity and ability to manage networking, error handling, and data flows within React Native apps. It also indirectly touches on their understanding of performance, pagination, and security in API interactions.&lt;/p&gt;

&lt;p&gt;Interpretation goes like:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;“Only REST using fetch” → Basic experience, suitable for simpler use cases.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;“REST with axios” → More practical; likely understands interceptors and async flows.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;“Worked with GraphQL using Apollo Client” → Advanced usage with state &amp;amp; schema management.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;“Mentioned caching, token handling, retries” → Strong grasp of real-world API concerns.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Q6. Have you worked on native side of react native, if yes which functionality developed and why ?
&lt;/h2&gt;

&lt;p&gt;evaluates a candidate’s depth of experience beyond JavaScript, specifically their ability to bridge native Android (Java/Kotlin) or iOS (Swift/Obj-C) modules with React Native. It’s a strong indicator of whether the candidate can build or integrate custom native functionality that isn’t available via existing JS libraries — something often needed in performance-critical or platform-specific cases. This question also reveals their understanding of the React Native bridge, JSI, permissions, native module lifecycle, and communication between native and JS layers.&lt;/p&gt;

&lt;p&gt;This helps me in getting in depth knowledge and experience of developer as:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;“No native work yet” → Pure JS experience; good for UI or feature work but limited in low-level customization.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;“Integrated native SDKs (e.g., camera, maps)” → Practical native linking experience.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;“Built custom modules using bridge/JSI” → Advanced skill set; can solve platform-level gaps.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;“Handled permissions or platform-specific UI” → Shows initiative in user experience and device integration.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Q7. Do you know the concept of jailbreak or rooting a device, if yes how can we prevent the same?
&lt;/h2&gt;

&lt;p&gt;assesses a candidate’s awareness of mobile security threats and their ability to protect sensitive app data from compromised environments. Jailbreaking (iOS) or rooting (Android) gives users full control over their device’s OS, often bypassing security restrictions. While this can be useful for advanced users, it poses significant risks for apps handling sensitive data (e.g., fintech, health, enterprise apps). The question evaluates whether the candidate understands how to detect rooted/jailbroken devices and implement preventive or defensive measures to mitigate the risk.&lt;/p&gt;

&lt;p&gt;Example Interpretation&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;“Not familiar with jailbreak/rooting” → Lacks security awareness; may be risky for sensitive app development.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;“Knows what it is but not how to handle it” → Basic awareness; needs upskilling in mobile security.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;“Mentions root detection libraries or platform checks” → Good understanding; can prevent app from running on compromised devices.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;“Uses obfuscation, integrity checks, and secure storage” → Advanced security mindset with layered defense approach.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Q8. What is props drilling and how can we avoid that?
&lt;/h2&gt;

&lt;p&gt;evaluates a candidate’s understanding of state and data flow management in React or React Native apps. Prop drilling refers to the process of passing data from a parent component to deeply nested child components via intermediate components that do not need the data themselves. This makes code harder to maintain and understand, especially in large applications. The question also tests whether the candidate knows alternative approaches to simplify or optimize state sharing across components.&lt;/p&gt;

&lt;p&gt;Evaluation matrix goes with response:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;“Not sure what it is” → Lacks understanding of component communication patterns.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;“Explains passing props through multiple levels” → Basic understanding of prop drilling.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;“Mentions useContext or Redux to avoid it” → Good grasp of global state and context-based solutions.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;“Uses tools like Zustand, Jotai, or component composition” → Advanced; explores modern alternatives to manage shared state cleanly.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Q9. At the end goes the coding question which helps me understand
&lt;/h2&gt;

&lt;p&gt;🧠 What This Question Evaluates&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Practical Implementation Skills&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;It shows how well the candidate can translate concepts into working code under light pressure.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Problem-Solving Approach&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;You get insight into how they break down requirements, structure components, and debug.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Code Quality &amp;amp; Best Practices&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;You can assess naming conventions, component structure, state management, and how clean or readable their code is.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Tool Familiarity&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;You see what tools or libraries they naturally reach for (useState, FlatList, axios, redux, etc.)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Depth Beyond Theory&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;It filters out candidates who only have surface-level knowledge but can’t implement real-world tasks.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Interpretation:
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;“Struggles to start or needs constant guidance” → Lacks hands-on experience or confidence.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;“Completes the task, but messily” → Knows the basics, needs refinement in structure or practices.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;“Implements clean, functional solution with edge cases handled” → Strong coding skills and thought process.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;“Adds extra features, optimizations, or error handling” → Excellent candidate with product mindset.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Comments are open, and so is the conversation 👇
&lt;/h2&gt;

</description>
      <category>reactnative</category>
      <category>interviewquestions</category>
      <category>interviewtips</category>
      <category>career</category>
    </item>
    <item>
      <title>SSL Pinning in React Native</title>
      <dc:creator>Mrinal Maheshwari</dc:creator>
      <pubDate>Wed, 11 Jun 2025 20:32:11 +0000</pubDate>
      <link>https://dev.to/maheshwarimrinal/ssl-pinning-in-react-native-2emp</link>
      <guid>https://dev.to/maheshwarimrinal/ssl-pinning-in-react-native-2emp</guid>
      <description>&lt;h2&gt;
  
  
  What is SSL Pinning?
&lt;/h2&gt;

&lt;p&gt;SSL pinning, also known as certificate pinning, is a security technique used to ensure that a client only trusts a specific server certificate and not any imposters or fake certificates. This technique helps to prevent man-in-the-middle (MITM) attacks, where an attacker intercepts communication between a client and a server and intercepts the SSL certificate, allowing them to read and modify the data being transmitted.&lt;/p&gt;

&lt;p&gt;In SSL pinning, the client is pre-configured with the expected SSL certificate or public key of the server. When the client establishes a connection with the server, it verifies the server’s certificate against the expected certificate or public key. If the certificates match, the connection is established, otherwise, the connection is terminated.&lt;/p&gt;

&lt;p&gt;This technique helps to ensure that the communication between the client and server is secure and free from tampering, even if an attacker tries to intercept the communication and present a fake certificate.&lt;/p&gt;

&lt;p&gt;Overall, SSL pinning provides an additional layer of security for sensitive information transmitted over the internet. It is commonly used in mobile and web applications to protect sensitive information such as login credentials, financial transactions, and personal data.&lt;/p&gt;

&lt;h2&gt;
  
  
  Types of SSL Pinning:
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Certificate Pinning: In this method, the client is pre-configured with the expected X.509 certificate of the server. When the client establishes a connection with the server, it verifies the server’s certificate against the expected certificate.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Public Key Pinning: In this method, the client is pre-configured with the expected public key of the server. When the client establishes a connection with the server, it verifies the server’s public key against the expected public key.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Subject Public Key Info (SPKI) Pinning: In this method, the client is pre-configured with the expected SPKI of the server. When the client establishes a connection with the server, it verifies the server’s SPKI against the expected SPKI.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Hash Function Pinning: In this method, the client is pre-configured with the expected hash of the server’s certificate or public key. When the client establishes a connection with the server, it calculates the hash of the server’s certificate or public key and verifies it against the expected hash.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Each of these methods provides a different level of security and is suited for different use cases. For example, certificate pinning provides the highest level of security, but it is also the most rigid and difficult to manage. Public key pinning, on the other hand, is more flexible and easier to manage, but provides a lower level of security.&lt;/p&gt;

&lt;p&gt;In general, SSL pinning should be used in conjunction with other security measures, such as SSL encryption, to provide a comprehensive security solution.&lt;/p&gt;

&lt;h2&gt;
  
  
  Implementing SSL Pinning in React Native (Public Key Pinning)
&lt;/h2&gt;

&lt;h2&gt;
  
  
  Extract public key of a certificate
&lt;/h2&gt;

&lt;p&gt;Before we set up our SSL pinning logic, we first need to retrieve the public key of our server’s certificate. Open a terminal session and enter the command below, replacing the server domain name with yours.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;First, we need public key of server certificate.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Open Terminal and enter command below, but don’t forget to change domain name (google.co.in) with your server’s domain name.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;openssl s_client -servername google.co.in -connect google.co.in:443 | openssl x509 -pubkey -noout | openssl pkey -pubin -outform der | openssl dgst -sha256 -binary | openssl enc -base64&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;openssl s_client -servername google.co.in -connect google.co.in:443 | openssl x509 -pubkey -noout | openssl pkey -pubin -outform der | openssl dgst -sha256 -binary | openssl enc -base64&lt;/p&gt;

&lt;p&gt;After this you will get output similar to the one given below. Do copy the base64 key from the end of output:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;...
verify return:1
depth=0 CN = *.google.co.in
verify return:1
Xthc0lj4iC4WT3stvwXerl89af709USBG3S5qJVz4fA=
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Android:
&lt;/h2&gt;

&lt;p&gt;The implementation on android is easy as Android already exposes the method for SSL Pinning. Under the hood React Native uses OKHttp and it comes with SSL Pinning support.&lt;/p&gt;

&lt;p&gt;We are not creating our own OkHttpClient builder instead we are using public method exposed on React Native OkHttpClientProvider which returns OkHttpClientBuilder . So that if any changes done be React Native in future we need not change anything in our code.&lt;/p&gt;

&lt;p&gt;In onCreate() method of MainApplication.java add the code&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;OkHttpClientProvider.setOkHttpClientFactory(new SSLPinnerFactory());
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Your code will look something like this&lt;/p&gt;

&lt;h2&gt;
  
  
  iOS:
&lt;/h2&gt;

&lt;p&gt;For implementing SSL Pinning in React Native for iOS we will use library called TrustKit add this line in your Podfile&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;pod 'TrustKit'
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Open the Project in Xcode and in AppDelegate.m and make changes in your code like this&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;By setting the kTSKSwizzleNetworkDelegates key to YES, TrustKit will then perform method swizzling on the App's NSURLSession and NSURLConnection delegates in order to automatically perform SSL pinning validation against the server's certificate chain, based on the configured pinning policy. This allows deploying TrustKit without changing the App's source code.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;By setting the kTSKSwizzleNetworkDelegates key to YES, TrustKit will then perform method swizzling on the App's NSURLSession and NSURLConnection delegates in order to automatically perform SSL pinning validation against the server's certificate chain, based on the configured pinning policy. This allows deploying TrustKit without changing the App's source code.&lt;/p&gt;

&lt;p&gt;To read full getting started guide regarding TrustKit refer this guide&lt;/p&gt;

&lt;p&gt;This completes the implementation of SSL Pinning in React Native using Public Key Pinning method.&lt;/p&gt;

&lt;p&gt;Suggestions, recommendations and requests for any topic is welcome in comments.&lt;/p&gt;

&lt;p&gt;Happy coding!&lt;/p&gt;

</description>
      <category>reactnative</category>
      <category>ios</category>
      <category>android</category>
      <category>appsecurity</category>
    </item>
  </channel>
</rss>
