# neact

> Neact is a fast alternative to React, support ie8

Latest version **1.0.10** (published 2017-06-21) · MIT license · 0 weekly downloads

## Install

```sh
npm install neact
pnpm add neact
yarn add neact
bun add neact
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.10 |
| Published | 2017-06-21 |
| First published | 2017-02-19 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 8 |
| Author | Nobo Zhou |
| Maintainers | bplok20010 |
| Keywords | neact, react, react-dom, virtual dom, components, vdom, virtual, jsx, js |

## Links

- npm: https://www.npmjs.com/package/neact
- Repository: https://github.com/bplok20010/neact
- Issues: https://github.com/bplok20010/neact/issues
- npm.io page: https://npm.io/package/neact

## Alternatives

- [@mapbox/jsonlint-lines-primitives](https://npm.io/package/@mapbox/jsonlint-lines-primitives.md) — 5.3M weekly downloads
- [reftools](https://npm.io/package/reftools.md) — 3.5M weekly downloads
- [@hey-api/openapi-ts](https://npm.io/package/@hey-api/openapi-ts.md) — 3.5M weekly downloads
- [@mapbox/geojson-rewind](https://npm.io/package/@mapbox/geojson-rewind.md) — 2.4M weekly downloads
- [turbo-stream](https://npm.io/package/turbo-stream.md) — 1.7M weekly downloads

## Recent versions

- 1.0.10 (latest) — 2017-06-21
- 1.0.9 — 2017-06-18
- 1.0.8 — 2017-06-06
- 1.0.7 — 2017-06-06
- 1.0.6 — 2017-06-06
- 1.0.5 — 2017-06-05
- 1.0.4 — 2017-06-04
- 1.0.3 — 2017-06-04
- 1.0.2 — 2017-02-23
- 1.0.1 — 2017-02-19
- 1.0.0 — 2017-02-19

## README

# Neact

Neact is a fast alternative to React, support ie8

## Usage

``` js

Neact.render(Neact.createElement('div', null, 'Hello Neact!'), document.body);

```

## Install

```sh
npm install neact
```

```sh
bower install neact
```

## Getting Started

### How to use JSX

```js
// 1.best to configure it globally in a .babelrc
// 2.Tell Babel to transform JSX into Neact.createElement() calls:
/** @jsx Neact.createElement */

function App(){
	return (
        <div id="foo">
            <span>Hello, world!</span>
            <button onClick={ e => alert("hi!") }>Click Me</button>
        </div>
    );
};

Neact.render(<App />, document.body);
```

### hooks Lifecycle

| Lifecycle method            | When it gets called                              |
|-----------------------------|--------------------------------------------------|
| `create`                    | see `componentDidMount`                          |
| `beforeUpdate`              | see `componentWillUpdate`                        |
| `update`                    | see `componentDidUpdate`                         |
| `destroy`                   | see `componentDidUnmount`                        |

```
let hooks = {
    create(vNode) {
        //TODO:
        //vNode.dom
    },
    beforeUpdate(lastVNode, nextVNode){
        //TODO:
    },
    update(nextVNode){
        //TODO:
    },
    destroy(vNode){
        //TODO:
    }
}

Neact.render(<div hooks={hooks}>Test</div>,document.body)
```

### Class Components Lifecycle

| Lifecycle method            | When it gets called                              |
|-----------------------------|--------------------------------------------------|
| `componentWillMount`        | before the component gets mounted to the DOM     |
| `componentDidMount`         | after the component gets mounted to the DOM      |
| `componentWillUnmount`      | prior to removal from the DOM                    |
| `componentWillReceiveProps` | before new props get accepted                    |
| `shouldComponentUpdate`     | before `render()`. Return `false` to skip render |
| `componentWillUpdate`       | before `render()`                                |
| `componentDidUpdate`        | after `render()`                                 |

```
var App = Neact.createClass({
    render(){
        return 'Test'
    },
    componentWillMount(){},
    componentDidMount(){},
    componentWillUnmount(){},
    componentWillReceiveProps(){},
    shouldComponentUpdate(){},
    componentWillUpdate(){},
    componentDidUpdate(){}
});

Neact.render(<App />,document.body)
```

### Functional Components Lifecycle

| Lifecycle method              | When it gets called                              |
|-------------------------------|--------------------------------------------------|
| `onComponentWillMount`        | before the component gets mounted to the DOM     |
| `onComponentDidMount`         | after the component gets mounted to the DOM      |
| `onComponentWillUnmount`      | prior to removal from the DOM                    |
| `onComponentShouldUpdate`     | before `render()`. Return `false` to skip render |
| `onComponentWillUpdate`       | before `render()`                                |
| `onComponentDidUpdate`        | after `render()`                                 |

```
let Lifecycle = {
    onComponentWillMount(vNode){},
    onComponentDidMount(vNode){},
    onComponentWillUnmount(vNode){},
    onComponentShouldUpdate(lastProps, nextProps, context){},
    onComponentWillUpdate(lastProps, nextProps, vNode){},
    onComponentDidUpdate(nextVNode){}
}

var App = function(){
    return 'Test'
};

Neact.render(<App {...Lifecycle} />,document.body)
```


## License

MIT

---
_Source: https://npm.io/package/neact · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
