Skip to content

Instantly share code, notes, and snippets.

@clairechabas
Created July 31, 2019 14:36
Show Gist options
  • Save clairechabas/3779b801cbe2770cfb34821ec8d78c34 to your computer and use it in GitHub Desktop.
Save clairechabas/3779b801cbe2770cfb34821ec8d78c34 to your computer and use it in GitHub Desktop.
Redux store enhanced with Firebase
import React from "react";
import ReactDOM from "react-dom";
import { BrowserRouter as Router } from "react-router-dom";
import "./css/index.css";
import App from "./components/App";
// SETTING UP REDUX STORE
import { Provider } from "react-redux";
import { createStore, applyMiddleware, compose } from "redux";
import reduxThunk from "redux-thunk";
import reducers from "./store/reducers";
// ENHANCING STORE WITH FIREBASE
import { reactReduxFirebase } from "react-redux-firebase";
import firebase from "./services/firebase";
const createStoreWithFirebase = compose(reactReduxFirebase(firebase))(
createStore
);
const store = createStoreWithFirebase(
reducers,
{},
applyMiddleware(reduxThunk)
);
ReactDOM.render(
<Provider store={store}>
<Router>
<App />
</Router>
</Provider>,
document.getElementById("root")
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment