
Show HN: Nerv – A fast React alternative, compatible with IE8 and React 16 - yuche
https://github.com/NervJS/nerv
======
TheAceOfHearts
I'd consider supporting IE8 an anti-feature. The browser is insecure,
unsupported, and non-standards compliant.

I've spent way too many hours of my life learning quirks of the horrible piece
of garbage that is IE8. I don't think I hate any other piece of software as
much.

If I had to support IE8 I'd instead try to make the site work without any JS.
Anything even moderately complex would run horribly anyway.

~~~
webster23
I think the reason for the IE8 support is that there are still lots of old
windows machines used in china. And if you think IE8 is bad, have you ever had
to support IE6? ;-)

~~~
git-pull
IE 5.5 with no box models would be a contender [1]

At Social Amp (2012), I was making cross domain single-page applications for
sites like 1-800-Flowers, where we had to support back to IE6, but, since a
tag was missing from the main website, we had to do some hacks to "shore up"
IE6 so the padding would be there.

It's feasible to have some pretty sweet JS (backbone.js, easyxdm) on IE6. The
limitation came from the engine's performance, stylesheet and js caps, and
really strict rules on, dangling commas (memory is a bit fuzzy in which
instances, but it'd crash our whole script). In some cases, there'd be no
errors, and it'd just freeze it.

[1]
[https://en.wikipedia.org/wiki/Internet_Explorer_box_model_bu...](https://en.wikipedia.org/wiki/Internet_Explorer_box_model_bug)

~~~
bonzini
Border-box is arguably more useful than content-box, so the IE5.5 is not a
huge deal. You can make other browsers act like IE5.5.

Back in the day it was quite a PITA though.

------
mxstbr
I'm a bit weary of this project since neither the website nor the readme
mention any tradeoffs. Surely, if I choose Nerv over React I miss out on
something—what is that something? Why would I _not_ use Nerv?

Opened an issue, hoping one of the authors chimes in and clarifies:
[https://github.com/NervJS/nerv/issues/10](https://github.com/NervJS/nerv/issues/10)

~~~
mxstbr
Thinking about this more, the React team recently (for the v16 rewrite)
rewrote almost their entire test suite to use their public API. I wonder
what'd happen if you ran that test suite with Nerv—if it passes all those
tests that'd be a great confidence booster!

Anybody up for trying?

~~~
e12e
Wasn't aware of the major v16 rewrite (I'm not working on a react front-end at
the moment). But seeing overviews like:
[https://dzone.com/articles/react-16-release-whats-
new](https://dzone.com/articles/react-16-release-whats-new)

(also: [https://reactjs.org/blog/2017/12/15/improving-the-
repository...](https://reactjs.org/blog/2017/12/15/improving-the-repository-
infrastructure.html))

makes me much more positive towards react - feels like there's some people
taking the stuff quite seriously. Still not sure about the whole js idea,
portable code that's unsigned etc - but things like this feels a little
less... Cowboys and cool-aid than I'm used to from the js side of things.

Some discussion here that I missed:
[https://news.ycombinator.com/item?id=15339983](https://news.ycombinator.com/item?id=15339983)

~~~
acemarke
Yeah, the React team takes backwards compatibility very seriously. They did
finally drop some deprecated methods from the main package in React 16, but
made them available as separate packages, and even wrote codemods to
automatically replace usages.

I can recommend several resources for understanding the changes in React 16:

\- Lin Clark's fantastic ReactConf presentation on "A Cartoon Intro to Fiber":
[https://youtu.be/ZCuYPiUIONs](https://youtu.be/ZCuYPiUIONs)

\- The official announcements for React 16:
[https://reactjs.org/blog/2017/09/26/react-v16.0.html](https://reactjs.org/blog/2017/09/26/react-v16.0.html)
and
[https://code.facebook.com/posts/1716776591680069/react-16-a-...](https://code.facebook.com/posts/1716776591680069/react-16-a-look-
inside-an-api-compatible-rewrite-of-our-frontend-ui-library/)

\- A good summary of the major changes:
[https://www.infoq.com/news/2017/05/react-fiber-closer-
look](https://www.infoq.com/news/2017/05/react-fiber-closer-look)

\- Two articles looking at the user-facing features and changes:
[http://www.benmvp.com/slides/2017/reactboston/fiber.html#/](http://www.benmvp.com/slides/2017/reactboston/fiber.html#/)
and [https://www.robinwieruch.de/what-is-new-in-
react-16/](https://www.robinwieruch.de/what-is-new-in-react-16/)

------
lgse
It would be great if the author could explain where the performance gains come
from and what the internal mechanics of the project are. Does it piggy back
onto the existing react repo? Is it just a forked react repo with performance
improvements? Giving some insight on that may give your potential users a good
reason to jump onto the bandwagon.

------
_bxg1
This smells like digital snake oil. It claims to be identical to React 16 +
IE8 support, improved performance, and reduced size, with little mention of
details about how any of that works and zero mention of tradeoffs. I don't see
how two developers came out of nowhere and one-upped one of the biggest tech
companies on the planet (with one of the biggest open-source communities on
the planet).

~~~
mlsarecmg
Apparently this isn't just two guys:
[https://twitter.com/rauchg/status/951185263698391040](https://twitter.com/rauchg/status/951185263698391040)

Another interesting bit:
[https://www.reddit.com/r/javascript/comments/7phc5q/a_fast_r...](https://www.reddit.com/r/javascript/comments/7phc5q/a_fast_react_alternative_compatible_with_ie8_and/dshdthh/)

~~~
lhorie
To add a bit of context to the second link (a comment I made): the core
patching algorithm in nerv is based on the patching algorithm from ivi, a
library that was created by Boris Kaul (creator of several benchmarking tools
used by virtual dom authors) as an exercise in making the fastest virtual dom
possible.

It popularized the prefix/suffix algorithm used in most vdom libs today, and
in addition, it's one of the only ones that use a LIS algorithm to further
decrease the number of DOM changes in complex DOM reordering scenarios. Ivi
also does a ton of other micro-optimizations.

Seeing that ivi was part of their research material tells me that this
library's perf claims have a least some foundation to back them up.

~~~
_bxg1
Good to know. Still, they could have done a much better job communicating
that.

~~~
lhorie
I'm actually just happy that this is even on Github at all (and with english
docs, to boot). If it's a jingdong project and the perf claims are true, it
could've been a competitive edge for them and they had no obligation to make
it open source.

------
abritinthebay
Size is nice but I see nothing to support claims of performance improvements
and React performance is rarely a problem in most apps anyhow (data
manipulation and JSON serialization are usually an order of magnitude more
impactful).

Also understanding why it’s better vs Preact/etc would be useful. The readme
is quite lacking on _why_ it should be used other than it’s React compatible.

Seems clever though.

~~~
nathancahill
The "why" is IE8 compat. If IE8 is a large part of your traffic that's a
compelling reason.

~~~
abritinthebay
If that's the only reason thats a reasonably small niche - WinXP only most
likely.

I mean China & India have _more_ of those machines but... it's still a niche.

------
styfle
It looks like the README[0] was recently translated from Chinese to English.

The Chinese README is still present in the current version published to NPM[1]
which is v1.2.2

[0]:
[https://github.com/NervJS/nerv/commit/18b1d8720b69d250603d58...](https://github.com/NervJS/nerv/commit/18b1d8720b69d250603d588f167d4eeee26ef48f)

[1]:
[https://www.npmjs.com/package/nervjs](https://www.npmjs.com/package/nervjs)

------
vcryan
Information about performance is on the webpage, scroll down to Benchmarks
section: [https://nerv.aotu.io/](https://nerv.aotu.io/)

~~~
city41
The benchmark tabs don't appear to work in Firefox (they work fine in Chrome).
Assuming the website is built with Nerv, that's a big red flag.

Firefox console says "Reference error, event is not defined" when clicking on
a tab.

~~~
nathancahill
Naw, that error is the easiest way to spot Chrome only developers. Webkit
provides the global event symbol within an event handler (old IE behavior).
With Firefox, you must explicitly pass an event variable. The difference
between:

    
    
        onClick () { event.doSomething() }

vs

    
    
        onClick (e) { e.doSomething() }
    

The error isn't firing from the Nerv library, it's from their usage of it on
the marketing site.

~~~
city41
I'd still say it's a red flag. The developers of a browser library didn't test
their site in Firefox. Makes me wonder if they tested the library in Firefox.
Nerv is a library that wants to take an absolutely critical role in my app, I
need to feel extremely confident choosing it.

~~~
nathancahill
Sure, it's a flag, but Nerv does have a test suite (with 96% coverage) that
proves it runs across all browsers. I'm sure the marketing site does not have
a test suite like that. You can't hold it to the same bar.

~~~
city41
That's fair. I'm just giving honest feedback. I understand Nerv is open source
and not being built by a large entity like Facebook. It's also likely a nice
library. So sure, I should cut them some slack. But at the same time, there's
a lot of React clones to choose from, and seeing a simple error like this
right out of the gate is off putting.

~~~
erk__
On the other hand it looks like it is being at least sponsered by JD.com [0]
which is a big chinese company [1]

[0] [https://jd.com/](https://jd.com/)

[1]
[https://en.wikipedia.org/wiki/JD.com](https://en.wikipedia.org/wiki/JD.com)

------
thangngoc89
I tried this on my ReasonReact app and it doesn't work. Seems like this has
many assumption about React internal instead of focusing on the public API

------
choward
Whenever I see some kind of project like this I expect to see an explanation
of why the project exists or why I would want to use it, especially if there
is another project it's trying to compete with. The only info I got was from
the title: IE8. I see the word performance being thrown around. Who cares if
you're not having performance issues?

------
jitl
Do you have any performance numbers or benchmarks by which to measure the
claims of superior performance? I’m not doubting you do see better perf - but
I’m curious how this compares to other React alternatives.

------
aetherspawn
The Y-axis on the benchmarks is labelled starting at 1. In short, this is
barely 20% quicker than React.

------
dfox
If you want to support old IEs, IE8 seems somewhat pointless as many
applications that really require compatibility with unsupported IE versions
have to support whatever is in Windows CE images on installed base of various
thin clients, which means IE5 or 6.

~~~
ng12
I'm (very unfortunately) an expert in this area. By the numbers IE8 is a must
if you want to support your site globally. I've only recently managed to
deprecated IE7, but IE5 and IE6 are negligible.

~~~
dfox
I'm not talking about public facing websites, but internal applications. For
public facing websites graceful degradation is at least for me acceptable and
it is not that hard to build site that gracefully degrades and is still usable
in browser that does not support JS and CSS at all.

~~~
ng12
If it were me, I would quit if our IT department still supported IE8. This
package was developed for JD.com which is a site where supporting IE8 makes a
lot of sense.

------
KayL
Is it 100% pass the React 16 tests?

------
kamikaz1k
Don't know if you're the author but under the Performance section, there is a
typo: "Le{r}an More". Also, your none of your performance graphs have a
label/unit of measure for the Y.

------
chubs
As far as i can tell, this has zero dependencies. Wow - impressive stuff!

------
KirinDave
I wish I understood why web developers hate polymer so much.

~~~
divanvisagie
I use Polymer at work quite a bit, and its really nice, but it's a completely
different approach based on trusting that the DOM is sane and running as close
to web standards as possible.

React and its 1 billion clones run off of the assumption that the DOM API is
not to be trusted, and that lets you target more browsers, even non browsers.
I mean have you ever tried to get Polymer stuff to work in Firefox? It's not
Pretty.

~~~
KirinDave
It worked fine for me in August 2017?

------
amelius
I'm confused by the title. Why no mention of e.g. Chrome, Safari or Firefox?

And if it's meant to be a React alternative, then I suppose it should support
native as well.

~~~
EgoIncarnate
It's suspect it's not in the title, because it's assumed and not interesting
or unique. Browser compatibility is listed on linked page.

While it may share a common history and core with ReactJS, React Native is
really a separate beast. I realize it may be confusing due to the overlap in
names. When people say React they are generally referring to
[https://reactjs.org](https://reactjs.org) and not the intersection it has
with [http://www.reactnative.com/](http://www.reactnative.com/) or the union
of the two projects.

~~~
underwater
React and React Native are very much related. Both use the same core 'react'
library, and differ between 'react-dom' and 'react-native' (and the native
code).

The official docs for React Native are at [http://facebook.github.io/react-
native/](http://facebook.github.io/react-native/) by the way.

~~~
EgoIncarnate
I know, which is why I said they have a common history and core. react and
react-dom are both part of the same github project at
[https://github.com/facebook/react](https://github.com/facebook/react).
Frequently when people are talking about React, they only mean the HTML
version, not including React Native. For example, the Nerv project mentioned
in this post.

While React Native makes use of the react core package, it is a separate
github project [http://facebook.github.io/react-
native/](http://facebook.github.io/react-native/)

------
dh-g
Its nice that the ideas of React are simple enough so that a single dev can
rewrite it as a side project but we probably have enough of these at this
point. Also React's performance is almost always the culprit for performance
issues in my experience.

------
dqv
Is this a fork of inferno js?

~~~
thewawar
Not a fork, fresh new, you can see the commit history.

------
SkyLinx
Another one??

------
johnmarks
cool project, will try out soon

