我刚开始使用react-redux-session。我使用npm安装了相同的内容并在我的react应用程序中实现了代码。但是会出现错误,localForage.setDriver is not a function
。我甚至为它安装了依赖项(localforage
),但仍然是错误。
我错过了一些必要的步骤吗?下面是我调用它的组件。
import App from './containers/App';
import Routes from './Routes';
import appReducer from './reducers';
import { Provider, connect } from 'react-redux';
import { createStore } from 'redux';
import { sessionService } from 'redux-react-session';
let store = createStore(appReducer);
const options = { refreshOnCheckAuth: true, redirectPath: '/login', driver:
'LOCALSTORAGE' };
sessionService.initSessionService(store, options);
ReactDOM.render(
<Provider store={store}>
<BrowserRouter>
<App>
<Routes />
</App>
</BrowserRouter>
</Provider>,
document.getElementById('main')
);
套餐详情:
"redux-react-session": "^2.1.0"<br/>
"localforage": "^1.5.2",
"webpack": "^3.5.6",<br/>
"webpack-dev-server": "^2.7.1"
任何建议都会有很大的帮助。
由于