Friday, 27 March 2026

React Core Architectural princciples

Core Architectural Principles

Modern React applications typically follow these foundational concepts to manage complexity:
  • Component-Based Design: The UI is divided into independent, reusable units called components. These components can be nested into a hierarchical tree structure.
  • Unidirectional Data Flow: Data flows in one direction, from parent to child components via "props". This "data down, events up" model makes the application's state more predictable.
  • Virtual DOM: React uses an in-memory representation of the real DOM. When the state changes, React "diffs" the Virtual DOM against the real one and updates only the necessary parts, significantly boosting performance.
  • Separation of Concerns: Clean architecture in React involves separating the UI (view) from the business logic. Developers often use custom hooks to encapsulate logic, keeping components focused purely on rendering.
Layered Architecture (Recommended for 2025)
For large-scale applications, a layered approach is widely adopted to decouple different parts of the system:
  1. UI Layer: Contains presentational components (buttons, inputs) and high-level pages.
  2. State Layer: Manages data using local state (useState), global state (Redux Toolkit, Zustand), or configuration state (Context API).
  3. Data/API Layer: Handles network requests, typically using Axios or fetch, often managed by server-state libraries like TanStack Query (React Query) for caching and synchronization.
  4. Utility Layer: House reusable helper functions (e.g., date formatting, validation) in a dedicated /utils directory

Wednesday, 18 March 2026

Cross browser testing - automation framework-cypress,playwrite; CloudBorwser -saucelabs browserstack

 Evaluating cross-browser testing for a React application involves assessing both functional consistency (JavaScript/API behavior) and visual integrity (CSS/layout) across different browser engines

  • UI Rendering & Layout: Check for misaligned elements, font rendering differences, and broken responsive breakpoints.
  • JavaScript Functionality: Verify that event handlers, form submissions, and asynchronous data fetching (e.g., fetch or axios calls) behave identically.
  • State Hydration: Ensure that the React state hydrates correctly in all browsers to prevent "blank screen" bugs common in Safari or older browsers.
  • Performance: Compare page load times and smoothness of animations/transitions across engines.
Recommended Testing Stack
A robust evaluation strategy combines automated scripts with real-device cloud access.
Tool TypeRecommended ToolsWhy for React?
Automation FrameworksPlaywrightCypressSeleniumSupports multiple browser engines; Playwright is often preferred for its native WebKit support.
Cloud Browser GridsBrowserStackLambdaTestSauce LabsProvides access to 3,000+ real browser/OS/device combinations without manual setup.
Visual TestingApplitoolsPercyUses AI to detect visual regressions and layout shifts that code-based tests might miss.

Saturday, 21 February 2026

React Windowing or List virtualization - React App optimization

 Windowing or List virtualization is a concept of only rendering or write the visible portion in the current “ window ” to the DOM. The number of items that rendered at first time are smaller than the original one.

The remaining items are rendered when you scroll down to it. The DOM nodes of items that exit the window are replaced by the new ones. This improves the performance of rendering a large list.


import React, { useState } from "react";
import ReactDOM from "react-dom";
import range from "lodash/range";

import "./styles.css";

function App() {
  const [render, setRender] = useState(false);
  const [itemCount, setItemCount] = useState(10000);

  return (
    <div>
      <h1>
        Render simple <code>{"<div />s"}</code>
      </h1>

      <div>
        Item count:{" "}
        <input
          type="number"
          value={itemCount}
          onChange={({ target: { value } }) => {
            setItemCount(value);
            setRender(false);
          }}
        />
      </div>
      <p>Notice the time it takes for the first loading</p>
      <button onClick={() => setRender(true)}>Render</button>
      <button onClick={() => setRender(false)}>Clear</button>

      <div>
        {render && range(itemCount).map(i => <div key={i}>Item {i}</div>)}
      </div>
    </div>
  );
}

const rootElement = document.getElementById("root");
ReactDOM.render(<App />, rootElement);

Wednesday, 18 February 2026

mysql to mariadb: unknown collation utf8mb4_0900_ai_ci

 57

I have a mysql 8.0 that I exported using mysqldump. I am trying to import it onto a Mariadb 10.4 database with phpmyadmin, both are the most current versions. Each time I do it though, I get:

Error: Unknown collation utf8mb4_0900_ai_ci

Then I went back into the sql file and replaced utf8mb4_0900_ai_ci with utf8mb4_general_ci, but then it says there are errors with various CREATE VIEW sql statements. Are there any other quick, error free fixes I can try?

React Core Architectural princciples

Core Architectural Principles Modern React applications typically follow these foundational concepts to manage complexity:   Component-Based...