News

InfernoJS v6.0.0, a React-like library for building high-performance user interfaces, is now out

2 min read

Yesterday, InfernoJS community announced the release of InfernoJS v6.0.0. This version comes with Fragments using which you can group a list of children without adding extra nodes to the DOM. Three new methods have been added: createRef, forwardRef, and rerender, along with few breaking changes.

Added support for Fragments

Support for Fragments, a new type of VNode, is added. It will enable you to group a list of children without adding extra nodes to the DOM. With Fragments, you can return an array from Component render creating an invisible layer which ties its content together but will not render any container to actual DOM.

Fragments can be created using the following four ways:

  • Native Inferno API: createFragment(children: any, childFlags: ChildFlags, key?: string | number | null)
  • JSX: <> … </>, <Fragment> …. </Fragment> or <Inferno.Fragment> … </Inferno.Fragment>
  • createElement API: createElement(Inferno.Fragment, {key: ‘test’}, …children)
  • Hyperscript API: h(Inferno.Fragment, {key: ‘test’}, children)

createRef API

Refs provide a way to access DOM nodes or React elements created in the render method.

You can now create refs using createRef() and attach them to React elements via the ref attribute. This new method allows you to write nicer syntax and reduces code when no callback to DOM creation is needed.

forwardRef API

forwardRef API allows you to “forward” ref inside a functional Component. This new method will be useful if you want to create a reference to a specific element inside simple functional Components. Forwarding ref means, automatically passing a ref through a component to one of its children.

rerender

With the help of the rerender method, all the pending setState calls will be flushed and rendered immediately. You can use it in the cases when the render timing is important or to simplify tests.

New lifecycle

Old lifecycle methods, componentWillMount, componentWillReceiveProps, or componentWillUpdate, will not be called when the new lifecycle methods, getDerivedStateFromProps or getSnapshotBeforeUpdate are used.

What are the breaking changes?

  • Since not all applications need server-side rendering, hydrate is now a part of the inferno-hydrate package.
  • Style properties now use hyphen. For example, backgroundColor => background-color.
  • In order to support JSX Fragment syntax, babel-plugin-inferno now depends on babel v7.
  • setState lifecycle is changed to have better compatibility with ReactJS. Also, componentDidUpdate will now be triggered later in the lifecycle chain, after refs have been created.
  • String refs are completely removed. Instead, you can use callback refs, createRef API, or forward Refs.

Read the release notes of InfernoJS on its GitHub repository.

Read Next

Node.js v10.12.0 (Current) released

The Ember project announces version 3.4 of Ember.js, Ember Data, and Ember CLI

React Native 0.57 released with major improvements in accessibility APIs, WKWebView-backed implementation, and more!

Bhagyashree R

Share
Published by
Bhagyashree R

Recent Posts

Top life hacks for prepping for your IT certification exam

I remember deciding to pursue my first IT certification, the CompTIA A+. I had signed…

3 years ago

Learn Transformers for Natural Language Processing with Denis Rothman

Key takeaways The transformer architecture has proved to be revolutionary in outperforming the classical RNN…

3 years ago

Learning Essential Linux Commands for Navigating the Shell Effectively

Once we learn how to deploy an Ubuntu server, how to manage users, and how…

3 years ago

Clean Coding in Python with Mariano Anaya

Key-takeaways:   Clean code isn’t just a nice thing to have or a luxury in software projects; it's a necessity. If we…

3 years ago

Exploring Forms in Angular – types, benefits and differences   

While developing a web application, or setting dynamic pages and meta tags we need to deal with…

3 years ago

Gain Practical Expertise with the Latest Edition of Software Architecture with C# 9 and .NET 5

Software architecture is one of the most discussed topics in the software industry today, and…

3 years ago