Frontend
Mini React Framework
A lightweight JavaScript framework built from scratch with a Virtual DOM, custom hooks, client-side routing, state management, and a TodoMVC application.
- JavaScript
Overview
MiniReact is a lightweight frontend framework built entirely from scratch using Vanilla JavaScript, without relying on React, Angular, Vue, or other frontend libraries.
The framework implements core concepts commonly found in modern frontend frameworks, including a Virtual DOM, component rendering, state management, event handling, hooks, and client-side routing.
It also includes a complete TodoMVC application built with the framework itself, serving as a practical demonstration of its rendering model, state updates, routing, and component architecture.
Problem Statement
Modern frontend frameworks hide much of the complexity involved in rendering interfaces, managing state, handling events, and synchronizing the UI with application data.
This project explores those internals by implementing the framework layer directly with native browser APIs.
The main challenge was designing a predictable rendering flow where user actions update state, produce a new Virtual DOM tree, reconcile changes efficiently, and update only the necessary parts of the real DOM.
Features Implemented
-
Built a custom Virtual DOM representation using JavaScript objects.
-
Implemented a diffing and reconciliation algorithm to minimize direct DOM updates.
-
Added support for functional components and reusable component composition.
-
Implemented a props system for passing data and callbacks between components.
-
Added keyed element reconciliation for efficient dynamic list rendering.
-
Implemented fragment support for rendering multiple elements without unnecessary wrappers.
-
Built a custom
useStatehook for component state management. -
Implemented
useEffectwith dependency tracking and cleanup support. -
Added
useReffor persistent mutable references across renders. -
Implemented batched state updates to reduce unnecessary re-rendering.
-
Added lifecycle handling for mounting, updating, and unmounting components.
-
Created a custom event API so framework users do not interact directly with
addEventListener(). -
Implemented programmatic navigation between application views.
-
Added conditional rendering and dynamic list rendering.
-
Built a complete TodoMVC application using the custom framework.
-
Implemented TodoMVC features including create, edit, delete, complete, filtering, clear-completed, toggle-all, and URL-based views.
Technical Highlights
-
Built a Virtual DOM and reconciliation engine from scratch using native browser APIs.
-
Implemented React-inspired hooks including
useState,useEffect, anduseRef. -
Designed a unidirectional rendering flow from state updates to Virtual DOM reconciliation.
-
Added keyed diffing, fragments, batched updates, and effect cleanup.
-
Implemented custom client-side routing with URL and application-state synchronization.
-
Built the framework with zero external dependencies.
Impact
The project provided a deeper understanding of how modern frontend frameworks manage rendering, state, component lifecycles, events, and routing behind their public APIs.
Building the framework from scratch also required solving low-level problems such as DOM reconciliation, hook execution order, dependency tracking, cleanup, and efficient list updates.
The TodoMVC implementation validated that the framework could support a complete interactive application rather than only isolated framework features.