ibitcy / react-stores-devtools-extension

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

React Stores Devtools Extension

React Stores Inspector

Debug your react stores with chrome devtools extension.

  • πŸ” Inspect stores current state
  • πŸ“œ Check store history step-by-step
  • πŸ”¬ Compare diff between states
  • πŸ“¨ Dispatch state directly from devtools
  • πŸ” Clickable stack trace for history and listeners
  • πŸš€ Use in production build
  • πŸ“¦ Works with isolated stores
  • 🎨 Familiar native chrome themes

screen_light

How to install

Demo

See how the extension works on Online demo

Usage

You don't have to do anything if you use react-stores@5.* or higher. Stores attach to devtool by themselves.

Advices

  • Use name in store options, otherwise you will see a hashes of the store in the devtool panel
  • Use $actionName when you call setState to better explore store history
const commonStore = new Store(
  {
    test: "name",
  },
  {
    name: 'Common Store',
    // ...otherOptions
  }
);

commonStore.setState({
  test: "newName"
  $actionName: 'changeName'
});

For old versions

Note: Some functions may now work

Start follow you stores with function

const storeOptions = {
  persistence: true
};

const oldStore = new Store(
  {
    test: "name",
    dateField: Date.now()
  },
  storeOptions
);

window["__REACT_STORES_INSPECTOR__"].attachStore(
  oldStore,
  "Old Store",
  storeOptions
);

oldStore.setState({
  test: "newName"
});

screen_dark

About

License:MIT License


Languages

Language:TypeScript 79.2%Language:JavaScript 20.1%Language:HTML 0.7%