import React from "react";
import ReactDOM from "react-dom";
import { BrowserRouter } from "react-router-dom";
import "./translations/i18n";
import * as serviceWorker from "./serviceWorker";
import { Provider } from "react-redux";
import { PersistGate } from "redux-persist/integration/react";
import { store, persistor } from "./redux/store";
import AppContainer from "./App/App.container";
import "./index.css";
import LoadingSpinner from "./components/loading-spinner/loading-spinner.component";

require("dotenv").config();

ReactDOM.render(
  <Provider store={store}>
    <BrowserRouter>
      <PersistGate
        loading={<LoadingSpinner message="PersistGate Loading." />}
        persistor={persistor}
      >
        <AppContainer />
      </PersistGate>
    </BrowserRouter>
  </Provider>,
  document.getElementById("root")
);

serviceWorker.register();
