All Projects → NervJS → Nerv

NervJS / Nerv

Licence: mit
A blazing fast React alternative, compatible with IE8 and React 16.

Programming Languages

javascript
184084 projects - #8 most used programming language
typescript
32286 projects

Projects that are alternatives of or similar to Nerv

Preact
⚛️ Fast 3kB React alternative with the same modern API. Components & Virtual DOM.
Stars: ✭ 30,527 (+464.37%)
Mutual labels:  vdom, jsx, preact
Inferno
🔥 An extremely fast, React-like JavaScript library for building modern user interfaces
Stars: ✭ 15,206 (+181.12%)
Mutual labels:  vdom, jsx, inferno
Omi
Front End Cross-Frameworks Framework - 前端跨框架跨平台框架
Stars: ✭ 12,153 (+124.68%)
Mutual labels:  vdom, jsx, preact
Vhtml
Render JSX/Hyperscript to HTML strings, without VDOM 🌈
Stars: ✭ 556 (-89.72%)
Mutual labels:  vdom, jsx, preact
Preact Render Spy
Render preact components with access to the produced virtual dom for testing.
Stars: ✭ 178 (-96.71%)
Mutual labels:  vdom, jsx, preact
Neo
Create blazing fast multithreaded Web Apps
Stars: ✭ 1,219 (-77.46%)
Mutual labels:  framework, vdom, frontend
Fritz2
Easily build reactive web-apps in Kotlin based on flows and coroutines.
Stars: ✭ 308 (-94.31%)
Mutual labels:  framework, frontend
Vuefront
VueFront Core. Turn your old-fashioned CMS website in to a SPA & PWA in 5 minutes
Stars: ✭ 316 (-94.16%)
Mutual labels:  framework, frontend
React Hint
Tooltip component for React, Preact, Inferno
Stars: ✭ 338 (-93.75%)
Mutual labels:  preact, inferno
Ivi
🔥 Javascript (TypeScript) library for building web user interfaces
Stars: ✭ 445 (-91.77%)
Mutual labels:  vdom, frontend
Choo Handbook
🚂✋📖 - Learn the choo framework through a set of exercises
Stars: ✭ 266 (-95.08%)
Mutual labels:  framework, frontend
Hyperapp
The tiny framework for building hypertext applications.
Stars: ✭ 18,724 (+246.16%)
Mutual labels:  framework, vdom
Hyperawesome
A curated list of awesome projects built with Hyperapp & more.
Stars: ✭ 446 (-91.75%)
Mutual labels:  vdom, jsx
Mini.css
A minimal, responsive, style-agnostic CSS framework!
Stars: ✭ 2,938 (-45.68%)
Mutual labels:  framework, frontend
Front End Web Development Resources
This repository contains content which will be helpful in your journey as a front-end Web Developer
Stars: ✭ 3,452 (-36.18%)
Mutual labels:  framework, frontend
Displayjs
A simple JavaScript framework for building ambitious UIs 😊
Stars: ✭ 590 (-89.09%)
Mutual labels:  framework, frontend
Bem Core
BEM Core Library
Stars: ✭ 275 (-94.92%)
Mutual labels:  framework, frontend
Preact Habitat
Zero configuration Preact widgets renderer in any host DOM
Stars: ✭ 444 (-91.79%)
Mutual labels:  vdom, preact
San
A fast, portable, flexible JavaScript component framework
Stars: ✭ 4,514 (-16.55%)
Mutual labels:  framework, frontend
Ijk
Transforms arrays into virtual dom trees; a terse alternative to JSX and h
Stars: ✭ 452 (-91.64%)
Mutual labels:  vdom, preact

Build Status License Coverage Status Downloads Build Status Sauce Test Status

Nerv is a virtual-dom based JavaScript (TypeScript) library with identical React 16 API, which offers much higher performance, tinier package size and better browser compatibility.

中文

Features

Identical React API, no 'nerv-compat' is needed

Battle tested, serve in JD.com home page and TOPLIFE.com

⚡️ High performance

🤣 IE8 compatibility

🎯 Tiny size, 9Kb gzipped

🌗 Isomorphic rendering on both client and server

💫 Support React 16 features, Error Boundaries, Portals, custom DOM attributes, etc.

Packages

This repository is a monorepo that we manage using Lerna. That means that we actually publish several packages to npm from the same codebase, including:

Package Description
nervjs The core of Nerv
nerv-redux Nerv binding for Redux
nerv-devtools Provides support for React's Dev Tools for Nerv
nerv-server Support for server side rendering
nerv-test-utils Suite of utilities for testing Nerv applications
nerv-utils Internal Helpers functions for Nerv
nerv-shared Internal shared functions for Nerv
nerv-create-class The legacy createClass API for Nerv

Getting Started

The easiest way to get started with Nerv is using CodeSandbox Playground, If you use React, you already know how to use Nerv.

Install

Of course we recommend that you use Nerv with Webpack and Babel.First you can install Nerv like this

With npm

$ npm install --save nervjs

With yarn

$ yarn add nervjs

Usage

Import what you need. Nerv provides both named and default exports, you can use Nerv as a namespace or simply import what you need as locals.

Default exports:

import Nerv from 'nervjs'
class HelloMessage extends Nerv.Component {
  render() {
    return <div>Hello {this.props.name}</div>
  }
}

Nerv.render(
  <HelloMessage name="Nerv" />,
  document.getElementById('app')
)

Named:

import { Component, render } from 'nervjs'
class HelloMessage extends Component {
  render() {
    return <div>Hello {this.props.name}</div>
  }
}

render(
  <HelloMessage name="Nerv" />,
  document.getElementById('app')
)

☝️ For more information please move to the official development document

Examples

Switching to Nerv from React

Switching to Nerv from React is easy as adding alias nervjs for react and react-dom. No changes in code needed.

Usage with Webpack

Add an alias in your webpack.config.js:

{
  // ...
  resolve: {
    alias: {
      'react': 'nervjs',
      'react-dom': 'nervjs',
      // Not necessary unless you consume a module using `createClass`
      'create-react-class': "nerv-create-class"
    }
  }
  // ...
}

Usage with Babel

Install the babel plugin for aliasing

$ npm install --save-dev babel-plugin-module-resolver

In .babelrc:

{
  "plugins": [
    ["module-resolver", {
      "root": ["."],
      "alias": {
        "react": "nervjs",
        "react-dom": "nervjs",
        // Not necessary unless you consume a module using `createClass`
        "create-react-class": "nerv-create-class"
      }
    }]
  ]
}

Usage with Browserify

Install the aliasify transform:

$ npm i --save-dev aliasify

Then in your package.json:

{
  "aliasify": {
    "aliases": {
      "react": "nervjs",
      "react-dom": "nervjs"
    }
  }
}

Compatible with React

Nerv currently support React API and features:

react

  • React.createClass (legacy)
  • React.createElement
  • React.cloneElement
  • React.Component
  • React.PureComponent
  • React.PropTypes
  • React.Children
  • React.isValidElement
  • React.createFactory
  • Error Boundaries (React 16)

react-dom

  • React.unstable_renderSubtreeIntoContainer (legacy)
  • ReactDOM.render
  • ReactDOM.unmountComponentAtNode
  • ReactDOM.findDOMNode
  • ReactDOM.hydrate (React 16)
  • ReactDOM.createPortal (React 16)

Internet Explorer 8 (or below) compatibility

First, install es5-polyfill:

npm install --save es5-polyfill

Then insert the code into the beginning of your entry file:

require('es5-polyfill');

At last, setting .babelrc if you are using babel:

{
  "presets": [
    ["env", {
      "spec": true,
      "useBuiltIns": false
    }],
    ["es3"]
  ],
  ...
}

Developer Tools

Nerv has a development tools module which allows you to inspect the component hierarchies via the React Chrome Developer Tools plugin.

To enable the Nerv development tools you must install the nerv-devtools module and then require('nerv-devtools') before the initial Nerv.render().

if (process.env.NODE_ENV !== 'production')  {
  require('nerv-devtools')
}
// before Nerv.render()
Nerv.render(<App />, document.getElementById('#root'))

nerv-devtools

Change Log

Acknowledgement

AOTU.IO(JD Multi-terminal Development Department)

License

FOSSA Status

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].