{"id":14971587,"url":"https://github.com/nervjs/nerv","last_synced_at":"2025-04-10T02:14:32.434Z","repository":{"id":44910449,"uuid":"90549237","full_name":"NervJS/nerv","owner":"NervJS","description":"A blazing fast React alternative, compatible with IE8 and React 16.","archived":false,"fork":false,"pushed_at":"2021-03-29T17:17:19.000Z","size":1806,"stargazers_count":5427,"open_issues_count":83,"forks_count":265,"subscribers_count":124,"default_branch":"master","last_synced_at":"2025-04-10T02:14:27.413Z","etag":null,"topics":["framework","frontend","inferno","javascript","jsx","nerv","nervjs","preact","react","reactjs","typescript","vdom","virutal-dom"],"latest_commit_sha":null,"homepage":"https://nerv.aotu.io","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/NervJS.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-05-07T17:20:01.000Z","updated_at":"2025-03-26T10:11:28.000Z","dependencies_parsed_at":"2022-07-30T13:08:01.699Z","dependency_job_id":null,"html_url":"https://github.com/NervJS/nerv","commit_stats":null,"previous_names":[],"tags_count":89,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NervJS%2Fnerv","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NervJS%2Fnerv/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NervJS%2Fnerv/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NervJS%2Fnerv/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/NervJS","download_url":"https://codeload.github.com/NervJS/nerv/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248142903,"owners_count":21054671,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["framework","frontend","inferno","javascript","jsx","nerv","nervjs","preact","react","reactjs","typescript","vdom","virutal-dom"],"created_at":"2024-09-24T13:45:29.687Z","updated_at":"2025-04-10T02:14:32.413Z","avatar_url":"https://github.com/NervJS.png","language":"JavaScript","readme":"\n\u003ch3 style=\"text-align:center;font-weight: 300;\" align=\"center\"\u003e\n  \u003cimg src=\"http://storage.360buyimg.com/mtd/home/logo-2x1513837926707.png\" width=\"160px\"\u003e\n\u003c/h3\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://www.npmjs.com/package/nervjs\"\u003e\u003cimg src=\"https://img.shields.io/npm/v/nervjs.svg?style=flat-square\" alt=\"Build Status\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://www.npmjs.com/package/nervjs\"\u003e\u003cimg src=\"https://img.shields.io/npm/l/nervjs.svg?style=flat-square\" alt=\"License\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://coveralls.io/github/NervJS/nerv?branch=master\"\u003e\u003cimg src=\"https://img.shields.io/coveralls/NervJS/nerv.svg?style=flat-square\" alt=\"Coverage Status\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://www.npmjs.com/package/nervjs\"\u003e\u003cimg src=\"https://img.shields.io/npm/dt/nervjs.svg?style=flat-square\" alt=\"Downloads\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://travis-ci.org/NervJS/nerv\"\u003e\u003cimg src=\"https://img.shields.io/travis/NervJS/nerv.svg?style=flat-square\" alt=\"Build Status\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://saucelabs.com/u/nerv-project\"\u003e\u003cimg src=\"https://saucelabs.com/browser-matrix/nerv-project.svg\" alt=\"Sauce Test Status\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n\n\u003e 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.\n\n[中文](/README_CN.md)\n\n## Features\n\n⚛ Identical React API, no 'nerv-compat' is needed\n\n️⚔ Battle tested, serve in [JD.com](https://www.jd.com/2017?t=1607) home page and [TOPLIFE.com](https://www.toplife.com)\n\n⚡️ High performance\n\n🤣 IE8 compatibility\n\n🎯 Tiny size, 9Kb gzipped\n\n🌗 Isomorphic rendering on both client and server\n\n💫 Support React 16 features, Error Boundaries, Portals, custom DOM attributes, etc.\n\n## Packages\n\nThis repository is a monorepo that we manage using [Lerna](https://github.com/lerna/lerna). That means that we actually publish [several packages](/packages) to npm from the same codebase, including:\n\n| Package           |   Description |\n| ------------- |:-------------:|\n| [`nervjs`](/packages/nerv)      |  The core of Nerv  |\n| [`nerv-redux`](/packages/nerv-redux)      |  Nerv binding for Redux  |\n| [`nerv-devtools`](/packages/nerv-devtools) | Provides support for React's Dev Tools for Nerv   |\n| [`nerv-server`](/packages/nerv-server) | Support for server side rendering |\n| [`nerv-test-utils`](/packages/nerv-test-utils) | Suite of utilities for testing Nerv applications   |\n| [`nerv-utils`](/packages/nerv-utils) |  Internal Helpers functions for Nerv  |\n| [`nerv-shared`](/packages/nerv-shared) |  Internal shared functions for Nerv  |\n| [`nerv-create-class`](/packages/nerv-create-class) |  The legacy `createClass` API for Nerv  |\n\n## Getting Started\n\nThe easiest way to get started with Nerv is using [CodeSandbox Playground](https://codesandbox.io/s/qkr5ww1q8j), If you use React, you already know how to use Nerv.\n\n### Install\n\nOf course we recommend that you use Nerv with [Webpack](https://webpack.js.org) and [Babel](https://babeljs.io).First you can install Nerv like this\n\nWith npm\n\n```bash\n$ npm install --save nervjs\n```\n\nWith yarn\n\n```bash\n$ yarn add nervjs\n```\n\n### Usage\n\nImport 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.\n\n**Default exports:**\n\n```javascript\nimport Nerv from 'nervjs'\nclass HelloMessage extends Nerv.Component {\n  render() {\n    return \u003cdiv\u003eHello {this.props.name}\u003c/div\u003e\n  }\n}\n\nNerv.render(\n  \u003cHelloMessage name=\"Nerv\" /\u003e,\n  document.getElementById('app')\n)\n```\n\n**Named:**\n\n```javascript\nimport { Component, render } from 'nervjs'\nclass HelloMessage extends Component {\n  render() {\n    return \u003cdiv\u003eHello {this.props.name}\u003c/div\u003e\n  }\n}\n\nrender(\n  \u003cHelloMessage name=\"Nerv\" /\u003e,\n  document.getElementById('app')\n)\n```\n\n☝️ For more information please move to the official [development document](https://nervjs.github.io/docs/)\n\n## Examples \n* [TodoMVC](https://github.com/NervJS/nerv-redux-todomvc), built with Nerv and Redux\n* [Nerv's landing page](https://github.com/NervJS/nerv-website), built with Nerv and [react-intl](https://github.com/yahoo/react-intl)\n* [JD.com](https://www.jd.com/2017?t=1607)\n* [TOPLIFE.com](https://www.toplife.com)\n\n\n## Switching to Nerv from React\n\nSwitching to Nerv from React is easy as adding alias `nervjs` for `react` and `react-dom`. No changes in code needed.\n\n### Usage with Webpack\n\nAdd an alias in your `webpack.config.js`:\n\n```js\n{\n  // ...\n  resolve: {\n    alias: {\n      'react': 'nervjs',\n      'react-dom': 'nervjs',\n      // Not necessary unless you consume a module using `createClass`\n      'create-react-class': \"nerv-create-class\"\n    }\n  }\n  // ...\n}\n```\n\n### Usage with Babel\n\nInstall the babel plugin for aliasing\n\n```bash\n$ npm install --save-dev babel-plugin-module-resolver\n```\n\nIn `.babelrc`:\n\n```js\n{\n  \"plugins\": [\n    [\"module-resolver\", {\n      \"root\": [\".\"],\n      \"alias\": {\n        \"react\": \"nervjs\",\n        \"react-dom\": \"nervjs\",\n        // Not necessary unless you consume a module using `createClass`\n        \"create-react-class\": \"nerv-create-class\"\n      }\n    }]\n  ]\n}\n```\n\n### Usage with Browserify\n\nInstall the aliasify transform:\n\n```bash\n$ npm i --save-dev aliasify\n```\n\nThen in your `package.json`:\n\n```js\n{\n  \"aliasify\": {\n    \"aliases\": {\n      \"react\": \"nervjs\",\n      \"react-dom\": \"nervjs\"\n    }\n  }\n}\n```\n\n## Compatible with React\n\nNerv currently support React API and features:\n\n### `react`\n\n* React.createClass (legacy)\n* React.createElement\n* React.cloneElement\n* React.Component\n* React.PureComponent\n* React.PropTypes\n* React.Children\n* React.isValidElement\n* React.createFactory\n* [Error Boundaries](https://reactjs.org/docs/error-boundaries.html#introducing-error-boundaries) (React 16)\n \n### `react-dom`\n\n* React.unstable_renderSubtreeIntoContainer (legacy)\n* ReactDOM.render\n* ReactDOM.unmountComponentAtNode\n* ReactDOM.findDOMNode\n* ReactDOM.hydrate (React 16)\n* ReactDOM.createPortal (React 16)\n\n\n## Internet Explorer 8 (or below) compatibility\n\nFirst, install `es5-polyfill`:\n\n```bash\nnpm install --save es5-polyfill\n```\n\nThen insert the code into the beginning of your entry file:\n\n```js\nrequire('es5-polyfill');\n```\n\nAt last, setting `.babelrc` if you are using `babel`:\n\n```js\n{\n  \"presets\": [\n    [\"env\", {\n      \"spec\": true,\n      \"useBuiltIns\": false\n    }],\n    [\"es3\"]\n  ],\n  ...\n}\n```\n\n## Developer Tools\n\nNerv has a development tools module which allows you to inspect the component hierarchies via the [React Chrome Developer Tools](https://chrome.google.com/webstore/detail/react-developer-tools/fmkadmapgofadopljbjfkapdkoienihi) plugin. \n\nTo enable the Nerv development tools you must install the `nerv-devtools` module and then `require('nerv-devtools')` before the initial `Nerv.render()`.\n\n\n```js\nif (process.env.NODE_ENV !== 'production')  {\n  require('nerv-devtools')\n}\n// before Nerv.render()\nNerv.render(\u003cApp /\u003e, document.getElementById('#root'))\n```\n\n\n![nerv-devtools](https://i.loli.net/2018/01/09/5a5480c074d99.png)\n\n\n## [Change Log](https://github.com/NervJS/nerv/blob/master/packages/nerv/CHANGELOG.md)\n\n## Acknowledgement\n\n[AOTU.IO（JD Multi-terminal Development Department）](https://aotu.io)\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2FNervJS%2Fnerv.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2FNervJS%2Fnerv?ref=badge_large)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnervjs%2Fnerv","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnervjs%2Fnerv","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnervjs%2Fnerv/lists"}