<?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: Sandip Das</title>
    <description>The latest articles on DEV Community by Sandip Das (@sandip108).</description>
    <link>https://dev.to/sandip108</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%2F2883238%2F37b13716-5a55-45a0-9e9f-aec0551de1df.jpg</url>
      <title>DEV Community: Sandip Das</title>
      <link>https://dev.to/sandip108</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/sandip108"/>
    <language>en</language>
    <item>
      <title>Modern JavaScript Features You Should Know (2024–2025)</title>
      <dc:creator>Sandip Das</dc:creator>
      <pubDate>Wed, 14 May 2025 14:12:46 +0000</pubDate>
      <link>https://dev.to/sandip108/modern-javascript-features-you-should-know-2024-2025-16ap</link>
      <guid>https://dev.to/sandip108/modern-javascript-features-you-should-know-2024-2025-16ap</guid>
      <description>&lt;p&gt;JavaScript keeps evolving — here are some recent and upcoming features that caught my attention:&lt;/p&gt;

&lt;p&gt;🔹 Array.prototype.toSorted() – Immutable sort &lt;br&gt;
🔹 Object.hasOwn() – Safer hasOwnProperty&lt;br&gt;
🔹 findLast() / findLastIndex() – Search from the end &lt;br&gt;
🔹 Top-level await – No more wrapping in async &lt;br&gt;
🔹 Promise.withResolvers() – Cleaner promise control&lt;br&gt;
🔹 Record &amp;amp; Tuple (proposal) – Immutable data structures&lt;/p&gt;

&lt;p&gt;**1. Array.prototype.toSorted()&lt;br&gt;
**Non-mutating alternative to sort().&lt;/p&gt;

&lt;p&gt;const numbers = [3, 1, 2];&lt;br&gt;
const sorted = numbers.toSorted(); // [1, 2, 3]&lt;br&gt;
console.log(numbers); // [3, 1, 2] – original array unchanged&lt;br&gt;
Great for immutability and functional programming&lt;/p&gt;

&lt;p&gt;**2. Object.hasOwn()&lt;br&gt;
**Safer and clearer alternative to hasOwnProperty.&lt;/p&gt;

&lt;p&gt;const user = { name: "Alex" };&lt;br&gt;
Object.hasOwn(user, "name"); // true&lt;br&gt;
Avoids prototype chain issues.&lt;/p&gt;

&lt;p&gt;**3. Top-level await&lt;br&gt;
**You can now use await outside of async functions in ES modules.&lt;/p&gt;

&lt;p&gt;const data = await fetch("/api/data").then(res =&amp;gt; res.json());&lt;br&gt;
console.log(data);&lt;br&gt;
Works only in modules (type="module" in HTML or .mjs files).&lt;/p&gt;

&lt;p&gt;**4. Promise.withResolvers() (ES2024 Proposal)&lt;br&gt;
**Cleaner way to create and control external promise resolution.&lt;/p&gt;

&lt;p&gt;const { promise, resolve, reject } = Promise.withResolvers();&lt;br&gt;
Very useful in custom async workflows.&lt;/p&gt;

&lt;p&gt;**5. Array.prototype.findLast() and findLastIndex()&lt;br&gt;
**Find from the end of an array.&lt;/p&gt;

&lt;p&gt;[1, 2, 3, 4].findLast(x =&amp;gt; x % 2 === 0); // 4&lt;br&gt;
Efficient backward searching&lt;/p&gt;

&lt;p&gt;Have you started using any of these? I'd love to hear your thoughts! &lt;/p&gt;

</description>
    </item>
    <item>
      <title>Micro Frontend Architecture Setup with ReactJS, TypeScript, RTK Query, Redux, Webpack Module Federation, SonarQube</title>
      <dc:creator>Sandip Das</dc:creator>
      <pubDate>Wed, 19 Feb 2025 13:10:55 +0000</pubDate>
      <link>https://dev.to/sandip108/micro-frontend-architecture-setup-with-reactjs-typescript-rtk-query-redux-webpack-module-1oan</link>
      <guid>https://dev.to/sandip108/micro-frontend-architecture-setup-with-reactjs-typescript-rtk-query-redux-webpack-module-1oan</guid>
      <description>&lt;p&gt;Micro Frontend Architecture Setup with ReactJS, TypeScript, RTK Query, Redux, Webpack Module Federation, SonarQube, Jest, Lerna, and Husky&lt;br&gt;
Micro Frontend Architecture (MFE) is a pattern that breaks down a large frontend monolithic application into smaller, self-contained units that are independently deployable. Each unit is responsible for a specific feature of the app and can be developed, tested, and deployed independently. This approach improves modularity, allows for technology flexibility, and enhances team collaboration.&lt;/p&gt;

&lt;p&gt;In this article, we will walk you through the setup of a micro frontend architecture using ReactJS, TypeScript, Redux Toolkit (RTK Query), Webpack Module Federation, SonarQube, Jest, Lerna, and Husky.&lt;/p&gt;

&lt;p&gt;Prerequisites&lt;br&gt;
Node.js and npm/yarn installed.&lt;br&gt;
Basic knowledge of React, TypeScript, Redux, Webpack, and testing.&lt;br&gt;
Familiarity with SonarQube for code quality checks.&lt;br&gt;
Let’s break down the architecture and setup in steps.&lt;/p&gt;

&lt;p&gt;Step 1: Project Structure&lt;br&gt;
Let’s assume we’re creating a system with multiple micro-frontends. We will create two React apps: App1 and App2, and a Shared UI package that contains common components. We'll use Lerna to manage these apps and their packages.&lt;/p&gt;

&lt;p&gt;Project Directory:&lt;br&gt;
/micro-frontend-architecture&lt;br&gt;
  /apps&lt;br&gt;
    /app1&lt;br&gt;
    /app2&lt;br&gt;
  /packages&lt;br&gt;
    /shared-ui&lt;br&gt;
  /tools&lt;br&gt;
    /husky&lt;br&gt;
  /node_modules&lt;br&gt;
  package.json&lt;br&gt;
  lerna.json&lt;br&gt;
  tsconfig.json&lt;br&gt;
  webpack.config.js&lt;br&gt;
apps/: Contains the main micro frontends (App1, App2).&lt;br&gt;
packages/: Contains shared components or packages.&lt;br&gt;
tools/: Contains Husky configuration for Git hooks.&lt;br&gt;
Step 2: Initialize the Monorepo Using Lerna&lt;br&gt;
Lerna will help us manage our monorepo. It enables efficient management of packages, dependencies, and versioning.&lt;/p&gt;

&lt;p&gt;Install Lerna globally:&lt;/p&gt;

&lt;p&gt;npm install -g lerna&lt;br&gt;
Initialize Lerna in the project folder:&lt;/p&gt;

&lt;p&gt;lerna init&lt;br&gt;
This will create the necessary files (lerna.json, packages/, etc.).&lt;/p&gt;

&lt;p&gt;Step 3: Create React Applications (App1, App2)&lt;br&gt;
Each app will be a separate React application, but they can share common components from the shared-ui package.&lt;/p&gt;

&lt;p&gt;Create App1:&lt;/p&gt;

&lt;p&gt;npx create-react-app apps/app1 --template typescript&lt;br&gt;
cd apps/app1&lt;br&gt;
npm install @reduxjs/toolkit react-redux&lt;br&gt;
Create App2 similarly in the apps/app2 directory.&lt;/p&gt;

&lt;p&gt;Step 4: Add Shared UI Package&lt;br&gt;
To share UI components across multiple apps, we’ll create a shared package.&lt;/p&gt;

&lt;p&gt;Inside the packages/ directory, create shared-ui:&lt;/p&gt;

&lt;p&gt;mkdir packages/shared-ui&lt;br&gt;
cd packages/shared-ui&lt;br&gt;
npm init -y&lt;br&gt;
npm install react react-dom&lt;br&gt;
Inside shared-ui, create a simple Button component (Button.tsx):&lt;/p&gt;

&lt;p&gt;import React from 'react';&lt;/p&gt;

&lt;p&gt;const Button = ({ children }: { children: React.ReactNode }) =&amp;gt; (&lt;br&gt;
  {children}&lt;br&gt;
);&lt;/p&gt;

&lt;p&gt;export default Button;&lt;br&gt;
Publish this component to your App1 and App2 by adding it as a dependency in package.json of both apps.&lt;/p&gt;

&lt;p&gt;Step 5: Webpack Module Federation for Micro Frontends&lt;br&gt;
Webpack’s Module Federation plugin is key to the micro-frontend architecture. It allows separate apps (micro-frontends) to share components or modules at runtime.&lt;/p&gt;

&lt;p&gt;In app1/webpack.config.js, add the following configuration:&lt;/p&gt;

&lt;p&gt;const ModuleFederationPlugin = require('webpack').container.ModuleFederationPlugin;&lt;/p&gt;

&lt;p&gt;module.exports = {&lt;br&gt;
  plugins: [&lt;br&gt;
    new ModuleFederationPlugin({&lt;br&gt;
      name: 'app1',&lt;br&gt;
      remotes: {&lt;br&gt;
        app2: 'app2@&lt;a href="http://localhost:3002/remoteEntry.js" rel="noopener noreferrer"&gt;http://localhost:3002/remoteEntry.js&lt;/a&gt;',&lt;br&gt;
      },&lt;br&gt;
      shared: ['react', 'react-dom', '@reduxjs/toolkit'],&lt;br&gt;
    }),&lt;br&gt;
  ],&lt;br&gt;
};&lt;br&gt;
Similarly, configure app2/webpack.config.js to expose its components to App1.&lt;/p&gt;

&lt;p&gt;Step 6: Redux and RTK Query Setup&lt;br&gt;
In both apps, use Redux Toolkit and RTK Query for state management.&lt;/p&gt;

&lt;p&gt;In both app1 and app2, set up Redux:&lt;/p&gt;

&lt;p&gt;npm install @reduxjs/toolkit react-redux&lt;br&gt;
Define a Redux slice (e.g., authSlice.ts) and create an API service with RTK Query (api.ts).&lt;/p&gt;

&lt;p&gt;authSlice.ts:&lt;/p&gt;

&lt;p&gt;import { createSlice, PayloadAction } from '@reduxjs/toolkit';&lt;/p&gt;

&lt;p&gt;const authSlice = createSlice({&lt;br&gt;
  name: 'auth',&lt;br&gt;
  initialState: { isAuthenticated: false },&lt;br&gt;
  reducers: {&lt;br&gt;
    login: (state) =&amp;gt; {&lt;br&gt;
      state.isAuthenticated = true;&lt;br&gt;
    },&lt;br&gt;
    logout: (state) =&amp;gt; {&lt;br&gt;
      state.isAuthenticated = false;&lt;br&gt;
    },&lt;br&gt;
  },&lt;br&gt;
});&lt;/p&gt;

&lt;p&gt;export const { login, logout } = authSlice.actions;&lt;br&gt;
export default authSlice.reducer;&lt;br&gt;
api.ts (RTK Query setup):&lt;/p&gt;

&lt;p&gt;import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react';&lt;/p&gt;

&lt;p&gt;export const api = createApi({&lt;br&gt;
  reducerPath: 'api',&lt;br&gt;
  baseQuery: fetchBaseQuery({ baseUrl: '&lt;a href="https://api.example.com" rel="noopener noreferrer"&gt;https://api.example.com&lt;/a&gt;' }),&lt;br&gt;
  endpoints: (builder) =&amp;gt; ({&lt;br&gt;
    getUser: builder.query({&lt;br&gt;
      query: () =&amp;gt; 'user',&lt;br&gt;
    }),&lt;br&gt;
  }),&lt;br&gt;
});&lt;/p&gt;

&lt;p&gt;export const { useGetUserQuery } = api;&lt;br&gt;
Step 7: Jest Setup for Unit Testing&lt;br&gt;
Jest can be used to test React components and Redux slices.&lt;/p&gt;

&lt;p&gt;Install Jest and React Testing Library in both app1 and app2:&lt;/p&gt;

&lt;p&gt;npm install --save-dev jest @testing-library/react @testing-library/jest-dom&lt;br&gt;
Configure jest.config.js in both apps:&lt;/p&gt;

&lt;p&gt;module.exports = {&lt;br&gt;
  preset: 'react-app',&lt;br&gt;
  setupFilesAfterEnv: ['@testing-library/jest-dom/extend-expect'],&lt;br&gt;
};&lt;br&gt;
Write unit tests for the components and Redux slices.&lt;/p&gt;

&lt;p&gt;Step 8: SonarQube Integration&lt;br&gt;
SonarQube helps analyze and ensure the quality of your codebase. You can set up SonarQube to continuously monitor the quality of your micro frontends.&lt;/p&gt;

&lt;p&gt;Install SonarQube CLI:&lt;/p&gt;

&lt;p&gt;npm install -g sonar-scanner&lt;br&gt;
Configure sonar-project.properties in the root of the project:&lt;/p&gt;

&lt;p&gt;sonar.projectKey=my-microfrontend-project&lt;br&gt;
sonar.sources=apps/app1/src,apps/app2/src&lt;br&gt;
sonar.host.url=&lt;a href="http://localhost:9000" rel="noopener noreferrer"&gt;http://localhost:9000&lt;/a&gt;&lt;br&gt;
Run SonarQube analysis:&lt;/p&gt;

&lt;p&gt;sonar-scanner&lt;br&gt;
Step 9: Husky for Git Hooks&lt;br&gt;
Husky will help set up Git hooks to ensure code quality by running linting, tests, or other checks before committing or pushing.&lt;/p&gt;

&lt;p&gt;Install Husky:&lt;/p&gt;

&lt;p&gt;npx husky-init&lt;br&gt;
npm install&lt;br&gt;
Configure Husky to run linting and tests before each commit:&lt;/p&gt;

&lt;p&gt;npx husky add .husky/pre-commit "npm run lint &amp;amp;&amp;amp; npm test"&lt;br&gt;
Conclusion&lt;br&gt;
By following the steps above, you’ve set up a micro frontend architecture with multiple React apps using:&lt;/p&gt;

&lt;p&gt;Lerna for managing the monorepo.&lt;br&gt;
Webpack Module Federation to expose and share components between apps.&lt;br&gt;
Redux and RTK Query for state management and data fetching.&lt;br&gt;
Jest for testing the components and logic.&lt;br&gt;
SonarQube for code quality checks.&lt;br&gt;
Husky for pre-commit hooks to maintain code quality.&lt;br&gt;
This setup provides a flexible, scalable, and maintainable architecture for building micro frontends in React.&lt;/p&gt;

</description>
      <category>react</category>
      <category>typescript</category>
      <category>webpack</category>
      <category>redux</category>
    </item>
  </channel>
</rss>
