When comparing Ractive.js vs Inferno, the Slant community recommends Ractive.js for most people. In the question“What are the best JavaScript libraries for building a UI?” Ractive.js is ranked 7th while Inferno is ranked 15th. The most important reason people chose Ractive.js is:
Ractive fully supports a templating language. To be more precise, views are written with a variant of Mustache, which is also extended to support inline JavaScript expressions. Soon it will be able to support other templating languages.
Specs
Ranked in these QuestionsQuestion Ranking
Pros
Pro Supports a true templating language
Ractive fully supports a templating language. To be more precise, views are written with a variant of Mustache, which is also extended to support inline JavaScript expressions. Soon it will be able to support other templating languages.
Pro Makes it possible to handle user interaction in a readable, declarative fashion
Ractive has a concept of proxy events, which translate a user action (e.g. a mouseclick) defined via an event directive into an intention (e.g. 'select this option'). This allows you to handle user interaction in a readable, declarative fashion.on-click='activate'
with arguments:on-click = 'activate: {{a}}, {{b}}'
It's activate
(and not click
, nor your function name) that is the name of the handler event that will be fired for any registered handlers created viaractive.on('activate', your_handler)
ractive.on('activate', your_another_handler)
Of course, Ractive also supports method calls like on-click='toggle(foo
)'
Pro Two-way binding configuration
Two-way binding can be turned off by those that are concerned it may be a source of bugs.
Pro Step by step tutorial
They have a great interactive tutorial which makes the learning process easy peasy. You will get into it within a couple of minutes.
Pro Virtual DOM
Instead of relying on the DOM, Ractive implements a virtual DOM from scratch, allowing it to calculate precisely what needs to be patched during the next screen refresh. This is orders of magnitude faster than fiddling with the DOM itself.
Pro Modular
Use it however you want in a framework of your own custom design. When things change in the industry, swap things out instead of being locked in by someone else's design.
Pro Pretty light-weight
Inferno weighs in at 9kb gzipped, which is light-weight.
Pro Fast performance
Inferno is one of the fastest UI libraries around and widely considered the fastest.
Pro React compatability
Using the Inferno compatibility package ("inferno-compat"), Inferno can support the vast majority of React codebases.
Cons
Con Ractive's two way binding can be a source of bugs
Two-way data-binding means that a HTML element in the view and an Ractive model are binded, and when one of them is changed so is the other. One-way data-binding for example does not change the model when the HTML element is changed.
This is a rather controversial subject and many developers consider two-way data binding an anti-pattern and something that is useless in complex applications because it's very easy to create complex situations by using it and being unable to debug them easily or understand what's happening by just looking at the code.
However, this is the default behaviour which can be changed to have one-way data binding.
Con Some React components may not work with Inferno
Inferno and React have different public and private APIs. If 3rd party components use a private API then it's almost certainly going to break when you use it with Inferno.
Once React Fiber is implemented, even libraries that are currently working will break and will not be supported by Inferno.
Con Not very popular
Which can hinder one's opinion of its future, but the future of all "frameworks" is to break things into smaller pieces, so inferno very well might get used by the big names in the future.