У меня проблема с моим магазином. Когда я открываю инструменты разработки в Chrome, у меня возникает такая проблема: «Магазин не найден. Обязательно следуйте инструкциям». Инструкция, которую я использовал https://github.com/zalmoxisus/redux-devtools-extension. Вот мой код:
. / ConfigureStore / index.js
import {createStore, applyMiddleware, compose} from 'redux';
import rootReducer from '../reducers/index';
import thunkMiddleware from 'redux-thunk';
const initialState = {
photos: []
}
export default function configureStore() {
const composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose;
const enhancers = composeEnhancers(applyMiddleware(thunkMiddleware));
const store = createStore(rootReducer,initialState,enhancers);
return store
}
и ./containers/Root.js
import React, {Component} from 'react';
import configureStore from '../configureStore/index.js';
import AsyncApp from './AsyncApp.js'
import {Provider} from 'react-redux';
import { render } from 'react-dom';
const store = configureStore();
export default class Root extends Component {
render() {
return (
<Provider store={store}>
<AsyncApp />
</Provider>
)
}
}
и index.js
import 'babel-polyfill'
import React from 'react'
import { render } from 'react-dom'
import Root from './containers/Root.js'
render(<Root />, document.querySelector('.fixed-container'));
это мой редуктор.
import { combineReducers } from 'redux';
import {
UPLOAD_PHOTOS_REQUEST,
UPLOAD_PHOTOS_SUCCES,
UPLOAD_PHOTOS_FAIL
} from '../actions/index.js'
const initialState = {
isFetching: false,
error: false,
photos: []
}
function photos(state = initialState, action) {
switch (action.type) {
case UPLOAD_PHOTOS_REQUEST:
return Object.assign({}, state, {
isFetching: true,
error: false
})
case UPLOAD_PHOTOS_SUCCES:
return Object.assign({}, state, {
isFetching: false,
error: false,
payload: action.payload,
recievedAt: action.receivedAt
})
case UPLOAD_PHOTOS_FAIL:
return Object.assign({}, state, {
isFetching: false,
error: true,
payload: action.payload,
})
default:
return {
...state,
photos: state.photos
}
}
}
const rootReducer = combineReducers({
photos
})
export default rootReducer;