Skip to content

Commit

Permalink
Document reactRefresh option (poi-bundler#31)
Browse files Browse the repository at this point in the history
  • Loading branch information
promer94 authored Aug 21, 2020
1 parent 0fb1c72 commit 79bbe5e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 25 deletions.
7 changes: 7 additions & 0 deletions docs/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,13 @@ Transpiled code:
let bar = 123
```

## reactRefresh

- Type: `boolean`
- CLI: `--react-refresh`

Enable React Refresh

## chainWebpack

- Type: `(config: WebpackChain, opts: Opts) => void`
Expand Down
28 changes: 3 additions & 25 deletions docs/guide/frameworks.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,38 +6,16 @@ How to use Poi with other frameworks and libraries.

Poi works out of the box in a React app, for example a React app that is created by facebooks's [create-react-app](https://github.com/facebook/create-react-app).

### Hot Reloading Support
### React Refresh Support

To add hot reloading support, simply add [react-hot-loader](https://github.com/gaearon/react-hot-loader) to your Babel config:
To enable react-refresh support, simply set `reactRefresh` to `true` at your Poi config:

```js
// babel.config.js
module.exports = {
presets: [
// Our default preset
'poi/babel'
],
plugins: [
// This adds Hot Reloading support
'react-hot-loader/babel'
]
reactRefresh: true
}
```

_(Don't forget to install react-hot-loader first: `yarn add react-hot-loader --dev`)_

Then mark your root component as hot-exported:

```js
// index.js
import React from 'react'
import { hot } from 'react-hot-loader'

const App = () => <div>Hello World!</div>

export default hot(module)(App)
```

## Vue

To use Poi in a Vue project, you should have `vue` and `vue-template-compiler` installed in your project:
Expand Down

0 comments on commit 79bbe5e

Please sign in to comment.