# π MiniReact - A Custom Renderer
MiniReact is a lightweight JavaScript function that mimics Reactβs rendering process. It converts JavaScript objects (similar to JSX) into real DOM elements.
## π Features
- β
Create DOM elements dynamically using JavaScript objects.
- β
Supports **nested elements** (e.g., `<a>` inside `<p>`).
- β
Allows adding **attributes** like `href`, `style`, `target`, etc.
- β
**Lightweight** β No external library required.
## π§ Usage
### 1οΈβ£ Clone the repository
```sh
git clone https://github.com/your-username/MiniReact.git
cd MiniReact
- Directly open the file in Chrome, Firefox, or any browser.
- Or use Live Server in VS Code.
MiniReact/
βββ index.html # Root file with <div id="root"></div>
βββ script.js # Custom render function
- The
script.js
file contains a custom rendering function that converts a JavaScript object into real DOM elements. - The function supports attributes (like
href
,style
,target
). - The rendered HTML is dynamically inserted into the
<div id="root"></div>
.
- Open
index.html
in your browser.
- Install Live Server extension in VS Code.
- Right-click
index.html
β Click "Open with Live Server". - The page will open in your browser.
- Add support for multiple children inside a parent element.
- Implement event listeners like
onClick
,onMouseOver
, etc. - Improve error handling and add console warnings.
Feel free to fork this repo and improve the rendering function! π
You can submit pull requests with bug fixes or enhancements.
This project is open-source under the MIT License.