How do you switch from React to Inferno/Preact?


#1

Here’s what I tried (e.g. for Inferno) which I read about on another thread here (Replacing React with Inferno using aliases - possible?) - added inferno and inferno-compat, added a .babelrc in root of my app, and added the settings from their site.

But when I then try to remove react, react-dom I got a ton of errors while building. And even without removing the code still wouldn’t run. Do you need to do anything else, I though babelrc support was no built in?


#2

This is an article that could help with switching to Preact. https://onespeed.io/blog/post/patent-free-react-ecosystem-migration-plan/


#3

I have no problems converting regular React apps. This is a Meteor specific issue. Has anyone does this in their Meteor app (I’m on latest v1.5.2)?


#4

I used Viewmodel with Inferno, and except the defer attribute on components(soon to be solved), everything works fine and I can reuse the same code between inferno and react (VM flavor).

So far VM feels good to use, see my Starter project
for a good way to quickly add components and frameworks like semantic-ui…


#5

A few months late but this could be good for anyone trying to use Preact.
Using the preact npm package should be enough. But meteor transpiles JSX to React.create.. calls.
Simple way around this is to:

import * as React from 'preact';