使用Redux时如何样式化React组件的样式

时间:2019-04-19 07:51:55

标签: reactjs redux react-styleguidist

我正在使用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>
)

任何帮助将不胜感激。

0 个答案:

没有答案