Render.js - UI Library for Web Applications
- Front-End
- Library
- Functional Programming
- Web Development
Challenge
To have better understanding of front-end web solutions and problems they solve, I decided to build my own React-like UI library.
Solution
A small set of functions written in vanilla JavaScript. Designed to run in browsers and can be easily bundled with your application using bundlers like esbuild. The solution is built with functional programming pattern and greatly relies on recursive functions.
This library is inspired by Vue.js, React and Grecha.js 🥣.
Features
-
Virtual DOM
-
Components
Creates HTML elements with a single function. It supports nesting, custom tags, attributes, event listeners, properties, and classes. -
State Management
Provides global state shared between all components ($state) and individual memory allocated per component instance ($componentState). -
Router
Has hash based router. -
Element Referencing & On Mount Hook
Provides$on_mounthook to execute JavaScript after render and elements can be accessible via custom reference.
Demo application built with Render.js
To-Do List (source):
- JavaScript