cookie value is undefined (react-cookie 2.0.6)

277
11 мая 2017, 12:47

Проблема с реализацией react cookie версии 2 и выше. Для запуска сайта я использую webpack-dev-server.
Вот что выводит консоль:

Warning: Failed context type: The context cookies is marked as required in withCookies(App), but its value is undefined.
in withCookies(App)
in Provider

/App.jsx:

import React, { Component } from 'react';
import { CookiesProvider, withCookies, Cookies} from 'react-cookie'
import {Route, Switch, BrowserRouter} from 'react-router-dom';
//import RequireAuth from './RequireAuth';
import NotFoundPage from './NotFoundPage';
import LandingPage from './LandindPage';
import WorkSpace from './WorkSpace';
import ActivationPage from './ActivationPage';
class App extends Component {
  render() {
    return (
      <CookiesProvider>
        <BrowserRouter>
          <Switch>
            <Route exact={true} path="/" component={LandingPage}/>
            <Route path="/workspace" component={WorkSpace}/>
            <Route exact path="/activation" component={ActivationPage}/>
            <Route path="*" component={NotFoundPage}/>
          </Switch>
        </BrowserRouter>
      </CookiesProvider>
    );
  }
}
export default withCookies(App);

/index.js:

import React from 'react';
import ReactDOM from 'react-dom';
import { createStore, applyMiddleware } from 'redux';
import reduxThunk from 'redux-thunk';
import reducers from './reducers';
import { Provider } from 'react-redux';
import App from './components/App';
const createStoreWithMiddleware = applyMiddleware(reduxThunk)(createStore);
const store = createStoreWithMiddleware(reducers);
ReactDOM.render(
  <Provider store = {store}>
    <App/>
  </Provider>
  ,
  document.getElementById('root'));
READ ALSO
Как сделать exe из кода на javascript?

Как сделать exe из кода на javascript?

Написал рабочий код, для будущей программы (автопостер на доски), юзаю его через редактор js от мозилыХочу сделать программу для пк (

304