Created
July 31, 2019 14:36
-
-
Save clairechabas/3779b801cbe2770cfb34821ec8d78c34 to your computer and use it in GitHub Desktop.
Redux store enhanced with Firebase
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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