BT

Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ

Topics

Choose your language

InfoQ Homepage News React Alternative Inferno Hits 1.0

React Alternative Inferno Hits 1.0

Leia em Português

This item in japanese

The React-like JavaScript library, Inferno, has reached version 1.0, giving developers familiar with React but frustrated with the size of modern JavaScript libraries a fix.

The tag line for Inferno is "An extremely fast React-like JavaScript library for building modern user interfaces." It's meant for those who like the concepts and API of React, but don't need all the bells and whistles such as the ability to use React Native. Inferno is built strictly for the browser or server and the typical DOM. Over the wire, Inferno weighs in at 9 KB compared to the 45 KB (both gzip sizes) payload of React. This results in much faster parse times and therefore better performance on mobile devices.

The team has spent a lot of time focused on actual performance. In an interview, founder Dominic Gannaway mentioned some of the work on performance:

Extensive checking was done to ensure that deoptimisations ("deopts", where a JIT compiler can't compile something) were kept to the absolute minimum. The Inferno team used benchmarks, profiling tools (IRHydra 2, Chrome Dev Tools) and lots of spikes re-writes on various parts of the codebase as way of constantly finding ways to remove deopts.

This code snippet shows how similar Inferno is to React:

class MyInfernoTest extends Component {
    componentDidMount() {
        setInterval(() => {
            this.setState({ 
                time: (new Date()).toLocaleString() 
            });
        }, 200);
    }
    render() {
        return <h2>
            Current time: <span>{this.state.time}</span>
        </h2>
    }
}

In a post announcing the release, core team engineer Luke Sheard noted that in 2016, the project rocketed from 150 stars on Github to almost 7,300 by the end of the year. It has over 8,000 now. It can be used as a drop-in replacement for React with an appropriate compatibility library, though performance improves by making Inferno specific code changes.

This year, the team hopes to expand the framework's ecosystem, but will need to do so without the ever-present guiding hand of Gannaway. At the end of 2016, Gannaway announced that he was joining Facebook to work on React. Sheard says that Inferno will carry on with a reduced role from Gannaway and that they're going to focus on improving the core experience and breadth of library support:

In 2017 Inferno will focus on continuously improving its core functions, addressing bugs as quickly as possible and providing support and guidance to the community. Effort will be placed into adapting new libraries to expand Inferno’s reach and modularity for a wide range of use cases. To date a range of modules have been ported, but with additional effort from the community we intend on expanding this further.

Inferno is a newcomer alongside the more well known React alternative, Preact. Both can be used in place of React, but the libraries differ in their focus.

Rate this Article

Adoption
Style

BT