# preact-refresh

> **Experimental package**

Latest version **0.4.1** (published 2020-05-03) · MIT license · 0 weekly downloads

## Install

```sh
npm install preact-refresh
pnpm add preact-refresh
yarn add preact-refresh
bun add preact-refresh
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.4.1 |
| Published | 2020-05-03 |
| First published | 2020-04-30 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 13.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | jdecroock |

## Links

- npm: https://www.npmjs.com/package/preact-refresh
- Repository: https://github.com/JoviDeCroock/preact-refresh
- Homepage: https://github.com/JoviDeCroock/preact-refresh#readme
- Issues: https://github.com/JoviDeCroock/preact-refresh/issues
- npm.io page: https://npm.io/package/preact-refresh

## Recent versions

- 0.4.1 (latest) — 2020-05-03
- 0.4.0 — 2020-05-03
- 0.3.1 — 2020-05-03
- 0.3.0 — 2020-05-01
- 0.2.0 — 2020-04-30
- 0.1.2 — 2020-04-30
- 0.1.1 — 2020-04-30
- 0.1.0 — 2020-04-30

## README

# Preact-Refresh

**Experimental package**

[![npm version](https://badgen.net/npm/v/preact-refresh)](https://www.npmjs.com/package/preact-refresh)

We are still fleshing out the details on how to go about this approach best for [Preact](https://github.com/preactjs/preact), we'd
love to give you the best reloading experience possible.

Note that now the refreshing component will dispose of its `hookState` to reload in case of added hook, ... this to ensure consistency.

## Setup

```
npm i -s preact-refresh
## OR
yarn add preact-refresh 
```

Then add it to your `webpack` config by doing

```js
import PreactRefreshPlugin from 'preact-refresh';

const config = {
  plugins: [
    new PreactRefreshPlugin(),
    new webpack.HotModuleReplacementPlugin(),
  ],
  devServer: {
    hot: true, // ensure dev-server.hot is on
    ...moreDevServerConfig
  },
  ...moreWebpackConfig
}
```

## Uncertainties

- [x] component altering lifecycles
- [x] error recovery
- [x] adding dependencies to hooks
- [x] state-hooks ordering
- [ ] avoid triggering effects for added dependencies
- [ ] transition better from Functional --> class and other way around
- [ ] provide fallback if no hot modules/no preact modules (window.location.reload())

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