<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by SHEKHAR DUBEY on Medium]]></title>
        <description><![CDATA[Stories by SHEKHAR DUBEY on Medium]]></description>
        <link>https://medium.com/@dubeyshekh15?source=rss-5f27a844da58------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*vG7ZCyx5NXBcQ3e8Wi392w.jpeg</url>
            <title>Stories by SHEKHAR DUBEY on Medium</title>
            <link>https://medium.com/@dubeyshekh15?source=rss-5f27a844da58------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 24 Nov 2026 01:21:11 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@dubeyshekh15/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Integrating Microsoft Intune MAM and MSAL in a React Native App]]></title>
            <link>https://medium.com/@dubeyshekh15/integrating-microsoft-intune-mam-and-msal-in-a-react-native-app-57e6d61a7651?source=rss-5f27a844da58------2</link>
            <guid isPermaLink="false">https://medium.com/p/57e6d61a7651</guid>
            <category><![CDATA[aml]]></category>
            <category><![CDATA[mobile-app-development]]></category>
            <category><![CDATA[microsoft-entra-id]]></category>
            <category><![CDATA[react-native]]></category>
            <category><![CDATA[microsoft-intune]]></category>
            <dc:creator><![CDATA[SHEKHAR DUBEY]]></dc:creator>
            <pubDate>Mon, 07 Sep 2026 07:26:04 GMT</pubDate>
            <atom:updated>2026-09-07T07:26:04.763Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1RY8ND7Rq9qLnAhYr-6j7g.png" /></figure><p>When I started working on Microsoft Intune support for a React Native application, I initially treated authentication and mobile application management as two separate problems.</p><p>In practice, they are closely connected.</p><p>The application needs to authenticate a user with Microsoft Entra ID, return that authentication result to React Native, establish the application’s own backend session, and register the authenticated identity with Intune so App Protection Policies can be applied.</p><p>This article documents the architecture and implementation approach I used. It covers both:</p><ol><li><strong>Native Intune App SDK + MSAL integration</strong></li><li><strong>Intune App Wrapping as an alternative deployment approach</strong></li></ol><p>The examples are intentionally generic so the same approach can be adapted to another React Native application.</p><h3>The two ways to integrate Intune</h3><p>Microsoft Intune MAM can generally be introduced into an application in two different ways.</p><h3>1. Native SDK integration</h3><p>The application integrates the Intune App SDK directly into its iOS and Android projects. MSAL is used for Microsoft Entra authentication.</p><p>This approach requires native code, but gives the application direct control over authentication, token handling, account registration, and the integration with React Native.</p><p>This is the approach I used for the main implementation.</p><h3>2. App wrapping</h3><p>An already-built application package is processed by the Intune App Wrapping Tool.</p><p>The application source does not need to contain Intune SDK code, but the resulting application is intended for managed internal/LOB distribution rather than the normal public app-store distribution path.</p><p>A simplified comparison looks like this:</p><p>Approach: Native Intune SDK + MSAL<br>Source Changes: Yes<br>Public Store Distribution: Yes<br>Best Fit: Production applications requiring full control</p><p>Approach: Intune App Wrapping<br>Source Changes: No Intune SDK changes in application source<br>Public Store Distribution: Not the normal public-store route<br>Best Fit: Internal / LOB managed applications</p><h3>The architecture I used</h3><p>The important design decision was to keep Microsoft authentication in native code while keeping the application flow in React Native.</p><p>The flow looks like this:</p><pre>React Native<br>    ↓<br>Native MSAL bridge<br>    ↓<br>Microsoft Entra ID authentication<br>    ↓<br>Microsoft account + access token<br>    ↓<br>Return result to React Native<br>    ↓<br>Send Microsoft token to application backend<br>    ↓<br>Backend creates application session<br>    ↓<br>Application access/refresh tokens<br>    ↓<br>Register account for Intune MAM<br>    ↓<br>App Protection Policy enforcement</pre><p>This separation turned out to be useful because the React Native layer does not need to know how MSAL is initialized on each platform. It simply calls a native module and receives a normalized authentication result.</p><h3>Why use native MSAL in a React Native app?</h3><p>The application already has a JavaScript authentication layer, but Microsoft Intune and MAM scenarios benefit from using the platform MSAL SDKs directly.</p><p>Using native MSAL made it possible to:</p><ul><li>Perform Microsoft Entra authentication using the official platform SDK.</li><li>Use the correct iOS and Android redirect URI handling.</li><li>Work with native account and token caches.</li><li>Register the authenticated account with Intune MAM.</li><li>Expose only the authentication result that React Native actually needs.</li><li>Clear the native account state cleanly during logout.</li></ul><p>The React Native layer therefore acts as the coordinator rather than implementing Microsoft authentication itself.</p><h3>Microsoft Entra application registration</h3><p>Before writing application code, the Microsoft Entra application registration needs to exist.</p><p>The application configuration provides values such as:</p><pre>Client ID<br>Tenant ID<br>Platform-specific redirect URI<br>Android package name<br>Android signing certificate signature hash</pre><p>The same logical application registration can support both iOS and Android, but each platform needs its own redirect configuration.</p><p>The most important rule is simple:</p><blockquote><em>The redirect URI configured in Microsoft Entra must match the URI handled by the application on that platform.</em></blockquote><h3>iOS implementation</h3><h3>1. Install MSAL</h3><p>MSAL is added through CocoaPods.</p><pre>pod &#39;MSAL&#39;</pre><p>Then install the pods:</p><pre>cd ios<br>pod install</pre><p>After that, open the .xcworkspace, not the .xcodeproj.</p><p>MSAL is used by the native authentication bridge to create the Microsoft Entra application, start interactive authentication, obtain tokens, enumerate accounts, and clear cached accounts during sign-out.</p><h3>2. Add the Intune frameworks in Xcode</h3><p>The Intune iOS SDK integration can require adding the supplied Intune frameworks to the Xcode project.</p><p>A simple workflow is:</p><ol><li>Open the iOS .xcworkspace in Xcode.</li><li>Select the main application target.</li><li>Go to <strong>General → Frameworks, Libraries, and Embedded Content</strong>.</li><li>Use <strong>+ → Add Other → Add Files</strong>.</li><li>Add the required Intune SDK frameworks, for example:</li></ol><pre>IntuneMAMSwift.xcframework<br>IntuneMAMSwiftStub.xcframework</pre><ol><li>Configure the embedding/signing setting required by the SDK.</li><li>Add any required Apple system frameworks listed by the Intune SDK documentation and validate the build.</li></ol><p>The exact framework list can change with SDK versions, so this is one area where I would always validate against the version of the Intune SDK being integrated.</p><p>Example —</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/618/1*C9PQIGIXeYanFtUB0lGBwQ.png" /></figure><h3>3. Configure Info.plist and the redirect URI</h3><p>The iOS application needs the Intune/MSAL configuration available to native code.</p><p>A typical configuration looks like this:</p><pre>&lt;key&gt;IntuneMAMPolicyRequired&lt;/key&gt;<br>&lt;true/&gt;</pre><pre>&lt;key&gt;IntuneMAMSettings&lt;/key&gt;<br>&lt;dict&gt;<br>    &lt;key&gt;ADALRedirectUri&lt;/key&gt;<br>    &lt;string&gt;msauth.com.example.app://auth&lt;/string&gt;</pre><pre>    &lt;key&gt;ClientID&lt;/key&gt;<br>    &lt;string&gt;YOUR_CLIENT_ID&lt;/string&gt;</pre><pre>    &lt;key&gt;TenantID&lt;/key&gt;<br>    &lt;string&gt;YOUR_TENANT_ID&lt;/string&gt;<br>&lt;/dict&gt;</pre><p>The URL scheme also needs to be registered:</p><pre>&lt;key&gt;CFBundleURLTypes&lt;/key&gt;<br>&lt;array&gt;<br>    &lt;dict&gt;<br>        &lt;key&gt;CFBundleURLSchemes&lt;/key&gt;<br>        &lt;array&gt;<br>            &lt;string&gt;msauth.com.example.app&lt;/string&gt;<br>        &lt;/array&gt;<br>    &lt;/dict&gt;<br>&lt;/array&gt;</pre><p>Together, these correspond to:</p><pre>msauth.com.example.app://auth</pre><p>The same redirect URI must also be configured for the iOS platform in Microsoft Entra.</p><h3>4. Build a small React Native bridge around MSAL</h3><p>I used a native module called MSALManager.</p><p>Its responsibilities were intentionally limited:</p><ul><li>Read the Microsoft configuration from Info.plist.</li><li>Create the MSAL authority.</li><li>Initialize MSALPublicClientApplication.</li><li>Start interactive sign-in.</li><li>Return the account email/username.</li><li>Return the Microsoft access token.</li><li>Clear cached accounts.</li><li>Perform sign-out.</li></ul><p>The authority is created using the tenant:</p><pre>https://login.microsoftonline.com/&lt;TENANT_ID&gt;</pre><p>The MSAL application configuration is then created from:</p><pre>Client ID<br>Redirect URI<br>Authority</pre><p>A simplified initialization pattern is:</p><pre>NSDictionary *settings =<br>    [[NSBundle mainBundle] objectForInfoDictionaryKey:@&quot;IntuneMAMSettings&quot;];</pre><pre>NSString *clientId = settings[@&quot;ClientID&quot;];<br>NSString *redirectUri = settings[@&quot;ADALRedirectUri&quot;];<br>NSString *tenantId = settings[@&quot;TenantID&quot;];</pre><pre>NSString *authorityURL =<br>    [NSString stringWithFormat:@&quot;https://login.microsoftonline.com/%@&quot;, tenantId];</pre><p>This keeps environment-specific Microsoft configuration out of the JavaScript bundle.</p><h3>5. iOS sign-in flow</h3><p>From React Native, the flow is simply:</p><pre>React Native<br>    ↓<br>MSALManager.startSignIn()<br>    ↓<br>MSAL interactive login<br>    ↓<br>Microsoft Entra ID<br>    ↓<br>MSAL result<br>    ↓<br>Account email + access token<br>    ↓<br>Return to React Native</pre><p>The application can request a scope based on:</p><pre>&lt;ClientID&gt;/.default</pre><p>I also found it useful to explicitly request account selection:</p><pre>params.promptType = MSALPromptTypeSelectAccount;</pre><p>This avoids unintentionally reusing a previous browser SSO session when the user needs to authenticate with a different Microsoft account.</p><h3>6. Clearing the MSAL cache during logout</h3><p>Logout is more than clearing the React Native session.</p><p>The native MSAL state should also be considered.</p><p>The sign-out flow I used clears:</p><pre>In-memory account state<br>    ↓<br>In-memory access token<br>    ↓<br>Locally stored username<br>    ↓<br>Cached MSAL accounts<br>    ↓<br>Browser sign-out where applicable</pre><p>Without clearing the MSAL account cache, a future authentication attempt can unexpectedly reuse an old account.</p><p>For that reason, the React Native logout flow calls the native MSAL cleanup method as part of the overall application logout.</p><h3>Android implementation</h3><p>Android follows the same high-level architecture, but the configuration and native bridge are different.</p><h3>1. Create msal_config.json</h3><p>The MSAL configuration is stored in the Android resources.</p><p>A generic example:</p><pre>{<br>  &quot;client_id&quot;: &quot;YOUR_CLIENT_ID&quot;,<br>  &quot;authorization_user_agent&quot;: &quot;DEFAULT&quot;,<br>  &quot;redirect_uri&quot;: &quot;msauth://com.example.app/YOUR_SIGNATURE_HASH&quot;,<br>  &quot;account_mode&quot;: &quot;SINGLE&quot;,<br>  &quot;broker_redirect_uri_registered&quot;: true,<br>  &quot;authorities&quot;: [<br>    {<br>      &quot;type&quot;: &quot;AAD&quot;,<br>      &quot;audience&quot;: {<br>        &quot;type&quot;: &quot;AzureADMyOrg&quot;,<br>        &quot;tenant_id&quot;: &quot;YOUR_TENANT_ID&quot;<br>      }<br>    }<br>  ]<br>}</pre><p>The Android redirect URI depends on:</p><ul><li>The application package name.</li><li>The signing certificate signature hash.</li></ul><p>Those values must match the Android platform configuration in Microsoft Entra.</p><h3>2. Configure AndroidManifest.xml</h3><p>The Android manifest needs to support the MSAL redirect.</p><p>A typical configuration uses BrowserTabActivity:</p><pre>&lt;activity<br>    android:name=&quot;com.microsoft.identity.client.BrowserTabActivity&quot;<br>    android:exported=&quot;true&quot;&gt;</pre><pre>    &lt;intent-filter&gt;<br>        &lt;action android:name=&quot;android.intent.action.VIEW&quot; /&gt;</pre><pre>        &lt;category android:name=&quot;android.intent.category.DEFAULT&quot; /&gt;<br>        &lt;category android:name=&quot;android.intent.category.BROWSABLE&quot; /&gt;</pre><pre>        &lt;data<br>            android:scheme=&quot;msauth&quot;<br>            android:host=&quot;com.example.app&quot;<br>            android:path=&quot;/YOUR_SIGNATURE_HASH&quot; /&gt;<br>    &lt;/intent-filter&gt;<br>&lt;/activity&gt;</pre><p>The manifest value, msal_config.json, and Microsoft Entra redirect URI must all describe the same redirect.</p><h3>3. Create the React Native bridge</h3><p>On Android I used a small native module that exposes methods such as:</p><pre>startSignIn()<br>getLatestAuthResult()<br>clearMsalAccount()<br>signOutInteractive()</pre><p>The module also emits authentication events back to JavaScript.</p><p>The useful responsibilities are:</p><ul><li>Start native MSAL authentication.</li><li>Return the latest account email and token.</li><li>Emit authentication success/failure events.</li><li>Clear the MSAL account.</li><li>Keep the React Native API consistent with iOS.</li></ul><p>The implementation can be written as a standard React Native ReactContextBaseJavaModule and registered through a ReactPackage.</p><h3>4. Authenticate and register the account for MAM</h3><p>The Android native authentication manager is responsible for initializing MSAL and starting the sign-in flow.</p><p>After successful authentication, the important values include:</p><pre>User principal name / username<br>Microsoft access token<br>Account ID<br>Tenant ID</pre><p>The account can then be registered for Intune MAM:</p><pre>val mamEnrollmentManager =<br>    MAMComponents.get(MAMEnrollmentManager::class.java)</pre><pre>mamEnrollmentManager?.registerAccountForMAM(<br>    upn,<br>    accountId,<br>    tenantId<br>)</pre><p>This is the key point where successful Microsoft authentication becomes connected to the Intune MAM identity.</p><h3>Returning the Microsoft token to React Native</h3><p>Both platforms ultimately return the same kind of result:</p><pre>accountEmail<br>accessToken</pre><p>React Native should not treat this Microsoft token as the application’s permanent session token.</p><p>In my implementation, the Microsoft access token is sent to the backend, which performs the application’s own authentication/exchange flow.</p><p>Conceptually:</p><pre>Native MSAL<br>    ↓<br>Microsoft access token<br>    ↓<br>React Native<br>    ↓<br>Application backend authentication endpoint<br>    ↓<br>Application access token<br>    +<br>Application refresh token</pre><p>The application then uses its own backend-issued tokens for subsequent API requests.</p><p>This separation is important because the Microsoft identity token/access token and the application’s session model serve different purposes.</p><h3>Prevent duplicate token exchanges</h3><p>One small issue worth handling in React Native is duplicate authentication events.</p><p>A native module may:</p><ul><li>Return a result from a method call.</li><li>Emit a success event.</li><li>Re-emit the latest state when the React context initializes.</li></ul><p>Without a guard, the JavaScript layer can accidentally send the same Microsoft token to the backend more than once.</p><p>The simplest solution is to track whether the current token is already being exchanged or has already been handled.</p><p>For example:</p><pre>Receive native auth result<br>        ↓<br>Is token already being processed?<br>        ↓<br>No → call backend<br>Yes → ignore duplicate event</pre><p>This avoids duplicate backend authentication calls and inconsistent navigation state.</p><h3>Logout flow</h3><p>The application logout should clear both layers of authentication:</p><pre>Application logout<br>    ↓<br>Clear application access token<br>    ↓<br>Clear application refresh token<br>    ↓<br>Clear local application session<br>    ↓<br>Clear native MSAL account<br>    ↓<br>Clear native cached auth state</pre><p>If the application only clears its backend tokens but leaves MSAL untouched, the next Microsoft login can silently reuse an existing account.</p><h3>Intune App Wrapping as an alternative</h3><p>Native SDK integration is not the only option.</p><p>For internally distributed applications, the Intune App Wrapping Tool can process an existing application package and produce an Intune-managed version.</p><p>The general idea is:</p><pre>Existing IPA / APK<br>    ↓<br>Intune App Wrapping Tool<br>    ↓<br>Wrapped application<br>    ↓<br>Sign/package as required<br>    ↓<br>Upload to Intune<br>    ↓<br>Assign to users/groups<br>    ↓<br>Managed installation</pre><p>The advantage is obvious: the application does not need to directly integrate the Intune SDK in its source code.</p><p>The trade-off is distribution and packaging flexibility.</p><h3>iOS app wrapping</h3><p>For iOS, the wrapping tool processes an existing application package.</p><p>A general command structure looks like:</p><pre>IntuneMAMPackager \<br>-i &lt;input.ipa&gt; \<br>-o &lt;output.ipa&gt; \<br>-p &lt;provisioning-profile.mobileprovision&gt; \<br>-c &lt;certificate-sha1&gt; \<br>-aa &quot;https://login.microsoftonline.com/&lt;TENANT_ID&gt;&quot; \<br>-ac &quot;&lt;CLIENT_ID&gt;&quot; \<br>-ar &quot;msauth.&lt;BUNDLE_ID&gt;://auth&quot; \<br>-v</pre><p>-i → Input IPA</p><p>-o → Wrapped output IPA</p><p>-p → Provisioning profile</p><p>-c → Signing certificate SHA1 hash</p><p>-aa → Microsoft Entra authority</p><p>-ac → Microsoft Entra application client ID</p><p>-ar → Redirect URI</p><p>If multiple branded variants exist, each variant should be treated as its own application identity with the appropriate bundle ID, redirect URI, and signing configuration.</p><p>Applications containing extensions should also be tested carefully because extensions can introduce additional signing and provisioning requirements.</p><h3>Android app wrapping</h3><p>Android can also use an Intune App Wrapping approach.</p><p>The general workflow is:</p><pre>Build application package<br>    ↓<br>Run Android Intune App Wrapping Tool<br>    ↓<br>Produce wrapped package<br>    ↓<br>Sign/package<br>    ↓<br>Upload to Intune<br>    ↓<br>Assign to users/groups</pre><p>In my exploration, the Android wrapping path was considered as an alternative and the tooling is typically handled in a Windows-based environment.</p><p>I did not use wrapping as the final Android implementation. The final implementation used direct native Intune SDK + MSAL integration instead.</p><p>That distinction matters: exploring a wrapping workflow is not the same as validating it for production.</p><h3>Configuring Intune App Protection Policies</h3><p>Once the application integration is complete, an Intune administrator can configure and assign an App Protection Policy.</p><p>Typical controls can include:</p><ul><li>Requiring an app PIN.</li><li>Requiring corporate identity.</li><li>Restricting copy and paste.</li><li>Restricting data transfer to unmanaged applications.</li><li>Restricting sharing of corporate data.</li><li>Applying selective wipe.</li><li>Requiring application protection before corporate data can be accessed.</li></ul><p>The exact policy options and behavior vary by platform and Intune configuration.</p><p>One of the main benefits of App Protection Policies is that corporate data can be protected at the application layer without necessarily requiring the entire device to be enrolled in device management.</p><h3>Testing checklist</h3><h3>Microsoft Entra</h3><ul><li>Application registration exists.</li><li>Client ID is correct.</li><li>Tenant ID is correct.</li><li>iOS redirect URI is registered.</li><li>Android redirect URI is registered.</li><li>Android package name matches the registration.</li><li>Android signature hash matches the registration.</li></ul><h3>iOS</h3><ul><li>MSAL installs successfully through CocoaPods.</li><li>Intune SDK frameworks are linked correctly.</li><li>The URL scheme is configured in Info.plist.</li><li>IntuneMAMSettings values are correct.</li><li>Interactive MSAL login works.</li><li>Account email and access token reach React Native.</li><li>Backend token exchange succeeds.</li><li>Native MSAL sign-out clears cached accounts.</li><li>A different Microsoft account can be selected after logout.</li></ul><h3>Android</h3><ul><li>msal_config.json is present and valid.</li><li>The package name matches the Microsoft Entra configuration.</li><li>The signature hash is correct.</li><li>BrowserTabActivity matches the redirect URI.</li><li>MSAL login works.</li><li>The authentication result reaches React Native.</li><li>Backend token exchange succeeds.</li><li>registerAccountForMAM() is called after authentication.</li><li>Sign-out clears the MSAL account.</li></ul><h3>Intune</h3><ul><li>The application is configured in Intune.</li><li>An App Protection Policy exists.</li><li>The policy is assigned to test users.</li><li>The test user can authenticate successfully.</li><li>Expected policy behavior is observed.</li><li>Copy/paste restrictions are tested.</li><li>Data sharing restrictions are tested.</li><li>App PIN behavior is tested if enabled.</li><li>Selective wipe is tested if configured.</li></ul><h3>Final thoughts</h3><p>The most useful lesson from this implementation was that Intune integration should not be treated as a single SDK installation task.</p><p>There are several pieces that need to agree with each other:</p><pre>Microsoft Entra registration<br>        +<br>Platform redirect configuration<br>        +<br>Native MSAL<br>        +<br>React Native bridge<br>        +<br>Backend authentication<br>        +<br>Intune account registration<br>        +<br>App Protection Policy</pre><p>If one of those pieces is misconfigured, the failure can appear somewhere else in the flow. A redirect problem can look like an MSAL problem. A package/signature mismatch can look like an Android authentication issue. A successful login does not necessarily mean the Intune account registration or policy assignment is complete.</p><p>For a React Native application, I found the cleanest design was to keep Microsoft and Intune-specific operations in small native modules, expose a simple authentication result to JavaScript, and let React Native continue to own the application-level navigation and backend session flow.</p><p>That gives the application the benefits of the native Microsoft SDKs without forcing the entire React Native codebase to become platform-specific.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=57e6d61a7651" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Build Once in React, Ship to iOS and Android with Capacitor — Without React Native]]></title>
            <link>https://medium.com/@dubeyshekh15/build-once-in-react-ship-to-ios-and-android-with-capacitor-without-react-native-1eab2bfe1582?source=rss-5f27a844da58------2</link>
            <guid isPermaLink="false">https://medium.com/p/1eab2bfe1582</guid>
            <category><![CDATA[react]]></category>
            <category><![CDATA[responsive-design]]></category>
            <category><![CDATA[capacitor]]></category>
            <category><![CDATA[mobile-development]]></category>
            <category><![CDATA[react-native]]></category>
            <dc:creator><![CDATA[SHEKHAR DUBEY]]></dc:creator>
            <pubDate>Wed, 12 Aug 2026 05:31:06 GMT</pubDate>
            <atom:updated>2026-08-12T05:31:06.721Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/599/1*QgOY7qLTbsNKd2A0IdLu3A.jpeg" /></figure><h3>The problem with “mobile app” by default</h3><p>Many teams assume mobile means:</p><ul><li>A duplicate codebase in React Native,</li><li>A separate mobile team, or</li><li>Responsive CSS that only shrinks desktop layouts.</li></ul><p>That often leads to three products pretending to be one: web, iOS, and Android — with duplicated business logic and inconsistent UX.</p><p>A better model for many enterprise apps:</p><blockquote><strong><em>Build one React app with intentional responsive behavior, then ship it inside a native shell with Capacitor.</em></strong></blockquote><p>You still get App Store / Play Store distribution. You do not need to rewrite your UI in React Native unless you truly need deep native capabilities.</p><h3>Responsive development should change the design — not just the width</h3><p>Responsive development should not mean “make the desktop layout smaller.” On mobile, the product should often <strong>change structure</strong>:</p><ul><li>Modals become bottom sheets</li><li>Multi-column boards become stacked views</li><li>Side rails collapse into toggles</li><li>Touch targets and spacing increase</li><li>Drag activation delays adjust for touch</li></ul><h3>Why Capacitor — fits where mobile has almost same UI as web</h3><p>Capacitor wraps your built web app ( dist/ ) in a native WebView container:</p><pre>React + Vite app (dist/)<br>        ↓<br>Capacitor native shell (iOS / Android)<br>        ↓<br>IPA / APK → App Store / Play Store</pre><p>You keep:</p><ul><li>React components</li><li>Your state layer (Redux, Zustand, etc.)</li><li>React Router (or equivalent)</li><li>Your design system</li><li>Responsive hooks and mobile-specific layouts</li></ul><p>Capacitor provides:</p><ul><li>Native project scaffolding ( ios/ , android/ )</li><li>WebView bridge</li><li>A plugin ecosystem for device APIs (camera, filesystem, push, etc.)</li><li>Store packaging through Xcode / Android Studio</li></ul><h3>Capacitor configuration</h3><p>A typical <strong>capacitor.config.ts</strong> :</p><pre>import type { CapacitorConfig } from &quot;@capacitor/cli&quot;;<br><br>const serverUrl = process.env.CAPACITOR_SERVER_URL?.trim();<br>const isCleartext = !!serverUrl &amp;&amp; serverUrl.startsWith(&quot;http://&quot;);<br><br>const config: CapacitorConfig = {<br>  appId: &quot;com.example.myapp&quot;,<br>  appName: &quot;My App&quot;,<br>  webDir: &quot;dist&quot;,<br>  ...(serverUrl<br>    ? {<br>        server: {<br>          url: serverUrl,<br>          cleartext: isCleartext,<br>          androidScheme: isCleartext ? &quot;http&quot; : &quot;https&quot;,<br>        },<br>      }<br>    : {}),<br>};<br><br>export default config;</pre><h3>Two runtime modes</h3><p><strong>1. Bundled mode (production-style shell)</strong></p><p>When <strong><em>CAPACITOR_SERVER_URL</em></strong> is <strong>not</strong> set, Capacitor loads assets from dist/ . Use this for offline-style shells and store packaging.</p><p><strong>2. Live server mode (development against backend)</strong></p><p>When <strong><em>CAPACITOR_SERVER_URL </em></strong>is<strong><em> </em></strong>set, the WebView loads a remote origin:</p><pre># Android emulator → host machine (localhost on the host maps to 10.0.2.2)<br>CAPACITOR_SERVER_URL=http://10.0.2.2:3000</pre><pre># Physical device on the same Wi‑Fi<br>CAPACITOR_SERVER_URL=http://192.168.x.x:3000</pre><pre># Local mapped hostname<br>CAPACITOR_SERVER_URL=https://app.local</pre><p>This is useful when the app depends on server-injected globals, session cookies, or legacy SDK clients that only exist when loading from a live backend. Pointing the WebView at a dev or staging origin keeps those available during native device testing.</p><h3>Commands: how to run with Capacitor</h3><p>Example <em>package.json</em> scripts:</p><pre>{<br>  &quot;build:capacitor&quot;: &quot;VITE_CAPACITOR=true tsc -b &amp;&amp; VITE_CAPACITOR=true vite build&quot;,<br>  &quot;cap:android&quot;: &quot;npm run build:capacitor &amp;&amp; npx cap sync android &amp;&amp; npx cap run android&quot;,<br>  &quot;cap:ios&quot;: &quot;npm run build:capacitor &amp;&amp; npx cap sync ios &amp;&amp; npx cap run ios&quot;<br>}</pre><p>(<em>pnpm</em> or <em>yarn</em> work the same way — swap the package manager in the scripts.)</p><h3>Day-to-day workflow</h3><p><strong>1. Develop responsive UI in the browser (fastest loop)</strong></p><pre>npm install<br>npm run dev</pre><p>Use Chrome DevTools device emulation and real mobile breakpoints while building.</p><p><strong>2. Build for Capacitor</strong></p><pre>npm run build:capacitor</pre><p><strong>3. Sync web assets into native projects</strong></p><pre>npx cap sync android<br>npx cap sync ios</pre><pre># or both platforms:<br>npx cap sync</pre><p><strong>4. Run on emulator or device</strong></p><pre>npm run cap:android<br>npm run cap:ios</pre><p>These scripts build, sync, and launch in one step.</p><p><strong>5. Open native IDEs (signing, debugging, release builds)</strong></p><pre>npx cap open android<br>npx cap open ios</pre><h3>Live backend testing on a device</h3><pre>CAPACITOR_SERVER_URL=http://10.0.2.2:3000 npm run cap:android<br>CAPACITOR_SERVER_URL=https://app.local npm run cap:ios</pre><p>Set the env var before sync/run so <em>capacitor.config.ts</em> picks up the server URL. The WebView loads the remote URL instead of bundled dist/ .</p><h3>Other useful Capacitor commands</h3><pre>npx cap copy      # copy web assets only (lighter than full sync)<br>npx cap update    # update native Capacitor dependencies<br>npx cap doctor    # check environment and setup</pre><h3>Producing IPA / APK</h3><p>Typical release flow:</p><pre>npm run build:capacitor<br>npx cap sync<br>npx cap open android   # Build → Generate Signed Bundle/APK<br>npx cap open ios       # Product → Archive → Distribute</pre><p>The Android shell typically uses a standard Capacitor bridge:</p><pre>public class MainActivity extends BridgeActivity {}</pre><p>No custom native code is required for the baseline app.</p><p>Configure in <em>capacitor.config.ts </em>:</p><ul><li><strong>App ID</strong> — reverse-DNS identifier (e.g. <em>com.example.myapp</em>)</li><li><strong>App name</strong> — display name on the home screen</li><li><strong>webDir</strong> — build output folder (usually <em>dist</em>)</li></ul><h3>Phase 1 without native plugins (and that is OK)</h3><p>A minimal Capacitor setup includes:</p><ul><li><em>@capacitor/core</em></li><li><em>@capacitor/cli</em></li><li><em>@capacitor/android</em></li><li><em>@capacitor/ios</em></li></ul><p>You do <strong>not</strong> need Camera, Push, Biometrics, or Filesystem plugins on day one.</p><p>Phase 1 is valid:</p><ul><li>React UI in a WebView</li><li>Responsive mobile layouts</li><li>Native shell + store packaging readiness</li></ul><p>Add native capabilities when product requirements justify them.</p><h3>Native features without rebuilding the whole app in React Native</h3><p>You do not need a separate React Native codebase for the main product. When native functionality is required later, choose the lightest option that fits.</p><h3>Option A: Capacitor plugins (preferred first)</h3><p>For common device APIs:</p><pre>npm install @capacitor/camera @capacitor/push-notifications<br>npx cap sync</pre><p>Call from React:</p><pre>import { Camera } from &quot;@capacitor/camera&quot;;</pre><pre>const photo = await Camera.getPhoto({ resultType: &quot;uri&quot; });</pre><p>Same React codebase. Native code stays inside plugin boundaries.</p><h3>Option B: Custom Capacitor plugin</h3><p>For company-specific native SDKs, write a thin native bridge and expose a JavaScript API to React.</p><p>Good when:</p><ul><li>One native capability is unique to your platform</li><li>You want to keep the main UI in React</li><li>You do not want a second full mobile codebase</li></ul><h3>Option C: Separate React Native or native module</h3><p>Use React Native or platform-native code only for features that truly need it:</p><ul><li>Advanced offline sync engines</li><li>Heavy background processing</li><li>Platform-specific hardware integrations</li><li>Legacy native SDKs with no web equivalent</li></ul><p>Integration patterns:</p><ul><li><strong>Deep links</strong> between the Capacitor app and a companion RN/native app</li><li><strong>Shared auth/session</strong> via secure storage or SSO</li><li><strong>Shared backend APIs</strong> (same domain services)</li><li><strong>Feature flags</strong> deciding which shell owns which experience</li></ul><p>This avoids rewriting complex web surfaces in React Native while still allowing native-heavy features where justified.</p><h3>Key takeaways</h3><ol><li><strong>Responsive React is the foundation</strong> — mobile layouts should change structure, not just width.</li><li><strong>Capacitor wraps your existing React app</strong> — you do not need React Native for the main product.</li><li><strong>Use </strong><em>build:capacitor</em><strong>, </strong><em>cap sync</em><strong>, and </strong><em>cap run</em><strong> </strong>as your native workflow.</li><li><em>CAPACITOR_SERVER_URL</em> enables live backend testing during development.</li><li><strong>Native plugins can be added later</strong> — they are not required for Phase 1.</li><li><strong>For advanced native features</strong>, use Capacitor plugins first; consider separate RN/native modules only for specialized capabilities.</li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1eab2bfe1582" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Redux Without React: A Framework-Agnostic Guide to Predictable State]]></title>
            <link>https://medium.com/@dubeyshekh15/redux-without-react-a-framework-agnostic-guide-to-predictable-state-ae48dc31a194?source=rss-5f27a844da58------2</link>
            <guid isPermaLink="false">https://medium.com/p/ae48dc31a194</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[frontend-architecture]]></category>
            <category><![CDATA[redux]]></category>
            <category><![CDATA[redux-toolkit]]></category>
            <dc:creator><![CDATA[SHEKHAR DUBEY]]></dc:creator>
            <pubDate>Tue, 11 Aug 2026 07:22:16 GMT</pubDate>
            <atom:updated>2026-08-11T07:22:16.159Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*HZG9URdjwSEEZVp4H-bL_g.jpeg" /></figure><p>Most developers first meet Redux through React. They see Provider, useSelector, and useDispatch, and reasonably conclude that Redux belongs to the React ecosystem.</p><p>It does not.</p><p>Redux is a <strong>JavaScript state management library</strong>. React Redux is only the adapter that connects Redux to React components. The store, actions, reducers, middleware, and selectors work the same way whether your UI is built with React, vanilla DOM APIs, Angular, Vue, Svelte, Web Components, or a server-side script that never touches a browser.</p><p>Understanding that distinction changes how you think about frontend architecture — especially during migrations, platform consolidation, or when you want shared business state across multiple UI technologies.</p><h3>The core idea in one sentence</h3><blockquote><strong><em>Redux holds application state and applies changes through explicit actions. Your UI subscribes to those changes and decides how to render.</em></strong></blockquote><p>Redux answers: <em>What is the state? How did it change?</em></p><p>Your UI answers: <em>What should the user see now?</em></p><p>Those are separate responsibilities — and keeping them separate is one of Redux’s biggest strengths.</p><h3>What Redux actually is</h3><p>At its heart, Redux is a small pattern built on four ideas:</p><ol><li>Store : Single object holding the entire application state</li><li>Actions : Plain objects describing <em>what happened</em> ({ type:&#39;tasks/added&#39;, payload: task })</li><li>Reducers : Pure functions that compute the next state from the previous state and an action</li><li>Dispatch : The only way to trigger a state change: store.dispatch(action)</li></ol><p>There is also a fifth mechanism that matters for rendering UI :</p><p>5. Subscribe : store.subscribe(listener) — run a callback after every dispatch</p><h3>Redux is not React — a mental model correction</h3><pre>┌─────────────────────────────────────────┐<br>│              Redux Store                │<br>│  state · reducers · middleware · thunks │<br>└─────────────────┬───────────────────────┘<br>                  │<br>        store.subscribe / store.getState<br>                  │<br>    ┌─────────────┼─────────────┬──────────────┐<br>    ▼             ▼             ▼              ▼<br> React UI    Vanilla DOM    Angular       Vue / Svelte<br> (react-redux) (manual)    (@ngrx/store)  (Pinia alt.)</pre><p><strong>React Redux</strong> (useSelector, useDispatch, Provider) is a binding layer.</p><p><strong>Redux Toolkit</strong> (configureStore, createSlice, createAsyncThunk) is a modern way to write Redux logic — still framework-agnostic.</p><p><strong>Your UI framework</strong> decides how DOM updates happen. Redux never touches the DOM directly.</p><h3>Minimal Redux in plain JavaScript</h3><p>Here is a complete, framework-free example.</p><h3>Step 1: Define state transitions</h3><pre>const initialState = {<br>  todos: [],<br>  filter: &quot;all&quot;,<br>};<br><br>function todosReducer(state = initialState, action) {<br>  switch (action.type) {<br>    case &quot;todos/added&quot;:<br>      return {<br>        ...state,<br>        todos: [...state.todos, action.payload],<br>      };<br>    case &quot;todos/toggled&quot;:<br>      return {<br>        ...state,<br>        todos: state.todos.map((todo) =&gt;<br>          todo.id === action.payload<br>            ? { ...todo, done: !todo.done }<br>            : todo,<br>        ),<br>      };<br>    case &quot;filter/set&quot;:<br>      return { ...state, filter: action.payload };<br>    default:<br>      return state;<br>  }<br>}</pre><h3>Step 2: Create the store</h3><pre>import { createStore } from &quot;redux&quot;;<br><br>const store = createStore(todosReducer);</pre><p>Or, in modern projects, prefer Redux Toolkit:</p><pre>import { configureStore, createSlice } from &quot;@reduxjs/toolkit&quot;;<br><br>const todosSlice = createSlice({<br>  name: &quot;todos&quot;,<br>  initialState: { items: [], filter: &quot;all&quot; },<br>  reducers: {<br>    added(state, action) {<br>      state.items.push(action.payload);<br>    },<br>    toggled(state, action) {<br>      const todo = state.items.find((t) =&gt; t.id === action.payload);<br>      if (todo) todo.done = !todo.done;<br>    },<br>    filterSet(state, action) {<br>      state.filter = action.payload;<br>    },<br>  },<br>});<br><br>const store = configureStore({<br>  reducer: { todos: todosSlice.reducer },<br>});<br><br>export const { added, toggled, filterSet } = todosSlice.actions;</pre><p>Redux Toolkit uses Immer internally, so “mutating” reducer syntax still produces immutable updates safely.</p><h3>Step 3: Subscribe and render manually</h3><pre>const listEl = document.querySelector(&quot;#todo-list&quot;);<br>const countEl = document.querySelector(&quot;#todo-count&quot;);<br><br>function selectVisibleTodos(state) {<br>  const { items, filter } = state.todos;<br>  if (filter === &quot;active&quot;) return items.filter((t) =&gt; !t.done);<br>  if (filter === &quot;done&quot;) return items.filter((t) =&gt; t.done);<br>  return items;<br>}<br><br>function render(state) {<br>  const todos = selectVisibleTodos(state);<br><br>  listEl.replaceChildren(<br>    ...todos.map((todo) =&gt; {<br>      const li = document.createElement(&quot;li&quot;);<br>      li.textContent = todo.label;<br>      li.classList.toggle(&quot;done&quot;, todo.done);<br>      li.addEventListener(&quot;click&quot;, () =&gt; store.dispatch(toggled(todo.id)));<br>      return li;<br>    }),<br>  );<br><br>  countEl.textContent = `${todos.length} items`;<br>}<br><br>// Initial render<br>render(store.getState());<br><br>// Re-render on every state change<br>store.subscribe(() =&gt; {<br>  render(store.getState());<br>});</pre><h3>Step 4: Dispatch actions from user events</h3><pre>document.querySelector(&quot;#add-btn&quot;).addEventListener(&quot;click&quot;, () =&gt; {<br>  const input = document.querySelector(&quot;#new-todo&quot;);<br>  const label = input.value.trim();<br>  if (!label) return;<br><br>  store.dispatch(<br>    added({ id: crypto.randomUUID(), label, done: false }),<br>  );<br>  input.value = &quot;&quot;;<br>});<br><br>document.querySelector(&quot;#filter-active&quot;).addEventListener(&quot;click&quot;, () =&gt; {<br>  store.dispatch(filterSet(&quot;active&quot;));<br>});</pre><p>Notice the flow:</p><pre>User clicks<br>  → dispatch(action)<br>  → reducer returns new state<br>  → subscribe callback runs<br>  → render(store.getState())<br>  → DOM updates (your responsibility)</pre><p>Redux never called document.createElement. <strong>You</strong> did — inside render.</p><h3>Key takeaways</h3><ol><li><strong>Redux is not a React library.</strong> React Redux is the React binding; the store itself is plain JavaScript.</li><li>store.dispatch<strong> changes state. </strong>store.subscribe<strong> notifies listeners.</strong> Rendering is always the UI layer&#39;s job unless you use a framework adapter.</li><li><strong>Redux Toolkit</strong> (configureStore, createSlice, createAsyncThunk, createSelector) is the modern standard and remains framework-agnostic.</li><li><strong>Vanilla JS integration is straightforward</strong> — but you must implement render strategy, lifecycle cleanup, and DOM diffing yourself.</li><li><strong>The same store can power multiple UI technologies</strong> during migration, which is valuable for large product consolidations.</li><li><strong>Test reducers and selectors without any UI</strong> — that portability is a major long-term advantage.</li></ol><h3>Closing thought</h3><p>Frameworks come and go. Rendering models change. Component APIs evolve.</p><p>Explicit state transitions tend to stick around — because they encode <em>what your application means</em>, not <em>how pixels get on screen</em>.</p><p>Redux’s greatest strength is not useSelector. It is the idea that state changes are named, traceable, testable events flowing through pure functions. You can plug that idea into React today, a Web Component tomorrow, and a different shell entirely next year.</p><p>That is why Redux belongs in your architecture toolbox — not just your React project.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ae48dc31a194" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>