Skip to content

Inferno v4

Compare
Choose a tag to compare
@Havunen Havunen released this 11 Feb 19:40
· 798 commits to master since this release

Inferno v4

In this release we have reworked Inferno's normalization process. In the previous versions Inferno always normalized all input, meaning it looped through all the vNode children checking for invalid nodes, flattening nested arrays etc. This process costs O(n) runtime, where n is number of input nodes. This has been improved by adding more logic into our babel plugin to detect static shapes compile time. Inferno will now normalize only dynamic shapes and even those can be avoided by pre-defining children shape using childFlags.

Breaking changes

There is v3 to v4 migration documentation available here

New features

  • {Inferno.createPortal(vNode, DOM)} can be used to render vNode to external location in DOM
  • Router has been updated to v4 to match React Router v4 API
  • Mobx and Redux integrations have been ported to the latest version
  • new VNodeFlag ReCreate has been added. It can be used to always re-create element instead of diffing it.
  • defaultHooks has been added to Functional Components
  • Inferno now supports IE9+ without polyfills reducing
  • Inferno size has been reduced to 7.8kb gzip including the ES2015 Component!
  • Small performance improvements
function Static() {
    return <div>1</div>;
}

Static.defaultHooks = {
    onComponentShouldUpdate() {
        return false;
    }
}

export const Com = Static;
  • TouchEvents are now part of Synthetic event system

Common changes:

All Inferno properties follow the same naming convention.

JSX Flags

NoNormalize has been removed, and is replaced by $HasVNodeChildren

hasKeyedChildren => $HasKeyedChildren

hasNonKeyedChildren => $HasNonKeyedChildren

ES6 Component properties that are considered private are now $ - prefixed.

Normalization process generated keys are now $ - prefixed.

Bug Fixes

  • XSS vulnerability has been fixed in inferno-server package

  • dangerouslySetInnerHTML now correctly unmounts previous nodes

  • hundreds of new tests have been added to inferno-compat

New website

We have also updated our Website https://infernojs.org/! If you have built something for inferno you can now add it there to utilities section 🥇

Open collective

InfernoJS is now part of open collective program, please consider supporting us!