A framework for building lightning fast user interfaces
Inferno is a framework for building user-interface components (specifically for the browser's DOM). Inferno achieves great performance for demanding applications by using virtual DOM as a lightweight representation of the actual DOM to construct interfaces in a simple manner. However, unlike other frameworks that use virtual DOMs, Inferno does not "diff" the virtual DOM on each update, but rather it carries out a "diff" on the actual values themselves. This technique allows Inferno to achieve lightning fast DOM operations with very little overhead.
Furthermore, Inferno deals exclusively with t7 templates. t7 parses template strings into optimised virtual DOM nodes that Inferno understands. Inferno then takes theses virtual DOM nodes and produces two sets of trees: a DOM tree and a value tree. It can then use both of these trees to intelligently make decisions based on what has changed and what needs to be created/removed/updated.
Note: Inferno is still in early development. Documentation, test coverage and features are a work-in-progress.
Let's start with some code. As you can see, Inferno intentionally keeps the same good (in our opinion) design ideas regarding components, one-way data passing and separation of concerns.
var message = "Hello world";Infernorendert7`<MyComponent message= />`documentgetElementById"app"
Furthermore, Inferno also uses ES6 components like React:
t7modulefuncitont7class Component implements InfernoComponentconstructorpropssuperprops;thisstatecounter = 0;renderreturn t7`<div><h1>Header!</h1><span>Counter is at: </span></div>`;t7assign"Component" Component;Infernorendert7`<Component />` documentbody;;
The real difference between React and Inferno is the performance offered at run-time. Inferno can handle large, complex DOM models without breaking a sweat. This is essential for low-power devices such as tablets and phones, where users of those devices are quickly demanding desktop like performance on their slower hardware.
t7(which comes bundled with Inferno).
[This section is still under development]
class MyComponent extends Componentrender
This is the base class for Inferno Components when they're defined using ES6 classes.
Render a t7 template into the DOM in the supplied container and return a reference to the component. If the t7 template was previously rendered into container, this will perform an update on it and only mutate the DOM as necessary to reflect the latest Inferno component.
Remove a rendered Inferno component from the DOM and clean up its event handlers and state.
[Development in progress]
Render a t7 template to its initial HTML. This should only be used on the server. Inferno will return an HTML string.
[Development in progress]
An alternative to using t7 for generating virtual DOM nodes for Inferno.
Inferno tries to address two problems with creating UI components:
Writing code should be fun. Browsers are getting more advanced and the technologies being supported are growing by the week. It's about time a framework offered more fun without compromising performance.
Inferno is still in early development and there are still many missing features and optimisations to be had. Do not use this framework in production environments until a stable release has been stated. Features that still need to be completed: