Supercharged JavaScript library to build user interfaces with modern React API and native templates.
Brahmos supports all the APIs of React including the upcoming concurrent mode APIs and the existing ones. It has its own custom fiber architecture and concurrent mode implementation to support the concurrent UI patterns.
Features
Lightweight and Fast.
Exact same React's Declarative APIs with JSX.
Fast alternative to Virtual DOM. (JSX without VDOM).
Smaller transpiled footprint of your source code, than traditional JSX.
It is inspired by the rendering patterns used on hyperHTML and lit-html.
It has the same declarative API like React, but instead of working with VDOM, it uses tagged template literals and HTML's template tag for faster rendering and updates.
It divides the HTML to be rendered into static and dynamic parts, and in next render, it has to compare the values of only dynamic parts and apply the changes optimally to the connected DOM.
It's unlike the VDOM which compares the whole last rendered VDOM to the new VDOM (which has both static and dynamic parts) to derive the optimal changes that are required on the actual DOM.
Even though tagged template literals are the key to static and dynamic part separation, the developer has to code on well adopted JSX.
Using the babel-plugin-brahmos it transforms JSX into tagged template literals which are optimized for render/updates and the output size.
With the tagged template literal we get a clear separating of the static and dynamic part. And on updates it needs to apply changes only on the changed dynamic parts.
Tagged template literals also have a unique property where the reference of the literal part (array of static strings) remain the same for every call of that tag with a given template.
Taking advantage of this behavior Brahmos uses literal parts as a cache key to keep the intermediate states to avoid the work done to process a template literal again.
Tagged template is natively supported by the browser, unlike the React's JSX which has to be transformed to React.createElement calls. So the output generated to run Brahmos has a smaller footprint than the output generated for the react.
For the above example, the Brahmos output is 685 bytes, compared to 824 bytes from the React output. More the static part of an HTML, greater the difference will be.
Demo
The following demo demonstrates the support of all the APIs coming in future version of React like Concurrent mode, suspense list, suspense for data fetch, and also for the existing APIs like states, hooks, context api, refs etc.
Class components with all life cycle methods (Except deprecated methods)
Functional Component
List and Keyed list
Synthetic input events - onChange support
Hooks
Context API
Refs Api, createRef, ref as callback, forwardRef
SVG Support
Suspense, Lazy, Suspense for data fetch, Suspense List
Concurrent Mode
3rd Party React library support (Tested React-router, redux, mobx, react-query, zustand, recharts)
React Utilities and Methods
Handle server rendering
Performance improvement
Bug fixes
Test Cases
FAQs
Super charged UI library with modern React API and native templates.
The npm package brahmos receives a total of 17 weekly downloads. As such, brahmos popularity was classified as not popular.
We found that brahmos demonstrated a not healthy version release cadence and project activity because the last version was released a year ago.It has 1 open source maintainer collaborating on the project.
Package last updated on 11 Dec 2020
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.