Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update instructions on hot reloading Alt stores #694

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/utils/hotReload.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ permalink: /docs/hot-reload/

When working with webpack and something like [react-hot-loader](https://github.com/gaearon/react-hot-loader) changing stores often causes your stores to be re-created (since they're wrapped) while this isn't a big deal it does cause a surplus of stores which pollutes the alt namespace and the alt debugger. With this util you're able to get proper hot replacement for stores, changing code within a store will reload it properly.

To use this just export a hot store using `makeHot` rather than using `alt.createStore`.
To use this, export your hot store using `makeHot` from [alt-utils package](https://github.com/altjs/utils) (`npm install alt-utils`), rather than using `alt.createStore`.

```js
import alt from '../alt';
import makeHot from 'alt/utils/makeHot';
import makeHot from 'alt-utils/lib/makeHot';

class TodoStore {
static displayName = 'TodoStore'
Expand Down