1

我正在使用 react、styleguidist 和 redux。我正在尝试根据 redux 商店状态记录不同的应用程序状态,但 .md 文件创建的游乐场仅使用一个商店。.md 文件如下所示:

import * as actions from './redux/actions';
import { Provider } from 'react-redux'
import store from './redux/store';

(
<Provider store={store}>
  <App />
</Provider>
)

在同一个 .md 文件中还有另一个 .js 块,例如 [here]:( https://react-styleguidist.js.org/docs/documenting.html#usage-examples-and-readme-files)块是:

import * as actions from './redux/actions';
import { Provider } from 'react-redux'
import store from './redux/store';

// the live sample in the styleguidist server updates correctly when dispatching the action
store.dispatch(actions.showConnection(true)); 

//THE PROBLEM IS THAT THE OTHER SAMPLE (THE ONE ABOVE) ALSO UPDATES) so there is one store for the entire sample

//¿How can I dispatch actions and only update the sample inside each ``` js code? 
//¿How can I mock  the redux store inside each js block sample in the .md file ? 
(
<Provider store={store}>
  <App />
</Provider>
)

任何帮助将不胜感激。

4

0 回答 0