How to use the redux-firestore.reduxFirestore function in redux-firestore

To help you get started, we’ve selected a few redux-firestore examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Sv1nnet / mario-plan-migrated-on-redux601-and-firebase300-alpha / src / index.js View on Github external
// We enhance compose in order to use Redux DevTools extension
// https://chrome.google.com/webstore/detail/redux-devtools/lmhkpmbekcpmknklioeibfkpmmfibljd
const composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose;

// Create config for rrfProps object. We need this to pass it in the ReactReduxFirebaseProvider component
const rrfConfig = {
  useFirestoreForProfile: true, // Firestore for Profile instead of Realtime DB
  userProfile: 'users',
  attachAuthIsReady: true,
};

const store = createStore(rootReducer,
  composeEnhancers(
    applyMiddleware(thunk.withExtraArgument({ getFirebase, getFirestore })),
    reduxFirestore(firebase), // still need this line to get access to firestore via getFirestore function (in projectActions, for example)
  ));

const rrfProps = {
  firebase,
  config: rrfConfig,
  dispatch: store.dispatch,
  createFirestoreInstance, // Create firestore instead of craete it in fbConfig.js
};

ReactDOM.render(
  
    
      
    
  ,
  document.getElementById('root'),
github hamsahmedansari / React-Realtime-Chat / src / store / index.js View on Github external
// import { createLogger } from "redux-logger";

import { getFirebase, reduxReactFirebase } from "react-redux-firebase";
import { getFirestore, reduxFirestore } from "redux-firestore";

import allReducer from "./reducers";
import fbconfig from "../firebase/";

// const composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose;
const composeEnhancers = compose;
const enhancer = composeEnhancers(
  applyMiddleware(
    thunk.withExtraArgument({ getFirebase, getFirestore })
    // createLogger()
  ),
  reduxFirestore(fbconfig),
  reduxReactFirebase(fbconfig)
);
const store = createStore(allReducer, enhancer);

export default store;
github sikidamjanovic / cowrite / src / index.js View on Github external
import React from 'react';
import ReactDOM from 'react-dom';
import App from './App';
import * as serviceWorker from './serviceWorker';
import { createStore, applyMiddleware, compose } from 'redux'
import rootReducer from './Store/Reducers/rootReducer'
import { Provider } from 'react-redux'
import thunk from 'redux-thunk'
import { reduxFirestore, getFirestore } from 'redux-firestore'
import { reactReduxFirebase, getFirebase } from 'react-redux-firebase'
import fbConfig from './Config/fbConfig'

const store = createStore(rootReducer, 
    compose(
        applyMiddleware(thunk.withExtraArgument({ getFirestore, getFirebase })),
        reduxFirestore(fbConfig),
        reactReduxFirebase(fbConfig, {attachAuthIsReady: true})
    )
);
store.firebaseAuthIsReady.then(() => {
    ReactDOM.render(
        
            
        , 
        document.getElementById('root'));
        serviceWorker.unregister();
})


// If you want your app to work offline and load faster, you can change
// unregister() to register() below. Note this comes with some pitfalls.
// Learn more about service workers: https://bit.ly/CRA-PWA
github NUS-ALSET / achievements / src / achievementsApp / store.js View on Github external
import { sagaInjector, sagaMiddleware } from "../services/saga";
import rootReducer from "./reducer";
import { firebaseConfig } from "./config";

// react-redux-firebase config
const rrfConfig = {
  userProfile: "courseMembers", // firebase root where user profiles are stored
  profileParamsToPopulate: ["members:users"]
};

const composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose;

// Add reactReduxFirebase enhancer when making store creator
// Add reduxFirestore enhancer when making store creator
const createStoreWithFirebase = compose(
  reduxFirestore(firebaseConfig),
  reactReduxFirebase(firebaseConfig, rrfConfig)
)(createStore);

export const configureStore = (preloadedState, history) => {
  const middlewares = [
    sagaMiddleware,
    routerMiddleware(history),
    actionsService.catchAction
  ];
  const store = createStoreWithFirebase(
    connectRouter(history)(rootReducer),
    preloadedState,
    composeEnhancers(applyMiddleware(...middlewares))
  );
  sagaInjector.injections.map(injection => sagaMiddleware.run(injection));
github google / ground-platform / web / src / store.js View on Github external
// react-redux-firebase config
const rrfConfig = {
  userProfile: 'users',
  useFirestoreForProfile: true,
};

firebase.initializeApp(firebaseConfig);
firebase.firestore().settings({timestampsInSnapshots: true});

// Add reactReduxFirebase enhancer when making store creator
const createStoreWithFirebase = compose(
    applyMiddleware(
        routerMiddleware(history) // for dispatching history actions
    ),
    reduxFirestore(firebase),
    reactReduxFirebase(firebase, rrfConfig)
)(createStore);

const initialState = {
  projectEditorOpen: false,
};

// TODO: use HOFs like compose() instead.
// TODO: Move connectRouter into reducers.
// Create store with reducers and initial state
const store = createStoreWithFirebase(
    rootReducer, initialState, composeWithDevTools());

export default store;
github bradtraversy / clientpanel_react / src / store.js View on Github external
const rrfConfig = {
  userProfile: 'users',
  useFirestoreForProfile: true // Firestore for Profile instead of Realtime DB
};

// Init firebase instance
firebase.initializeApp(firebaseConfig);
// Init firestore
const firestore = firebase.firestore();
const settings = { timestampsInSnapshots: true };
firestore.settings(settings);

// Add reactReduxFirebase enhancer when making store creator
const createStoreWithFirebase = compose(
  reactReduxFirebase(firebase, rrfConfig), // firebase instance as first argument
  reduxFirestore(firebase)
)(createStore);

const rootReducer = combineReducers({
  firebase: firebaseReducer,
  firestore: firestoreReducer,
  notify: notifyReducer,
  settings: settingsReducer
});

// Check for settings in localStorage
if (localStorage.getItem('settings') == null) {
  // Default settings
  const defaultSettings = {
    disableBalanceOnAdd: true,
    disableBalanceOnEdit: false,
    allowRegistration: false
github nwplus / nwhacks2019 / web / services / store / index.js View on Github external
if (process.env.NODE_ENV === 'development') {
        return `http://localhost:5000/${selectedFirebaseConfig.projectId}/us-central1/${functionName}`;
      } // production
      return `https://us-central1-${selectedFirebaseConfig.projectId}.cloudfunctions.net/${functionName}`;
    },
  };

  // Initialize Cloud Firestore through Firebase
  const firestore = firebase.firestore();
  const firestoreSettings = { timestampsInSnapshots: true };
  firestore.settings(firestoreSettings);

  // Add reactReduxFirebase store enhancer when making store creator
  const createStoreWithFirebase = compose(
    reactReduxFirebase(firebase, rrfConfig),
    reduxFirestore(firebase),
  )(createStore);

  // Add firebase to reducers (uses persistReducer and hardSet)
  const rootReducer = combineReducers({
    firebase: persistReducer(
      { key: 'firepersist', storage: localStorage, stateReconciler: hardSet },
      firebaseReducer
    ),
    firestore: firestoreReducer,
    root: persistReducer(
      { key: 'app', storage: localStorage, stateReconciler: hardSet },
      Reducers
    ),
  });

  const persistedReducer = persistReducer(persistConfig, rootReducer);
github ChingStore / ching / src / redux / store.js View on Github external
import firebaseConfig from 'config/firebase'

firebase.initializeApp(firebaseConfig)
firebase.firestore().enablePersistence()

const reduxLogger = ReduxLogger.createLogger({
  collapsed: true,
  duration: true,
  logErrors: true,
  diff: true,
})

const store = Redux.createStore(
  rootReducer,
  ReduxDevtoolsExtension.composeWithDevTools(
    reduxFirestore(firebase),
    reactReduxFirebase(firebase),
    Redux.applyMiddleware(
      ReduxThunk.withExtraArgument({ getFirebase, getFirestore }),
      reduxLogger
    )
  )
)

export default store
github zero-to-mastery / visual-music / src / store / store.js View on Github external
import rootReducer from './reducers/rootReducer';

import { reactReduxFirebase, getFirebase } from 'react-redux-firebase';
import { reduxFirestore, getFirestore } from 'redux-firestore';
import FBConfig from '../firebase/config';

export const store = createStore(
    rootReducer,
    compose(
        applyMiddleware(thunk.withExtraArgument({ getFirebase, getFirestore })),
        reactReduxFirebase(FBConfig, {
            attachAuthIsReady: true,
            userProfile: 'users',
            useFirestoreForProfile: true
        }),
        reduxFirestore(FBConfig)
    )
);
github suot / footprint-frontend / src / index.js View on Github external
import ReactDOM from 'react-dom';
import './index.css';
import App from './App';
import * as serviceWorker from './serviceWorker';
import { createStore, applyMiddleware, compose } from 'redux';
import rootReducer from './store/reducers/rootReducer';
import { Provider } from 'react-redux';
import thunk from 'redux-thunk';
import { reduxFirestore, getFirestore } from 'redux-firestore';
import { reactReduxFirebase, getFirebase } from 'react-redux-firebase';
import fbConfig from './components/auth/config/fbConfig';

const store = createStore(rootReducer,
    compose(
        applyMiddleware(thunk.withExtraArgument({ getFirebase, getFirestore })),
        reduxFirestore(fbConfig),
        reactReduxFirebase(fbConfig, {useFirestoreForProfile: true, userProfile: 'users', attachAuthIsReady: true})
    )
);


store.firebaseAuthIsReady.then(() => {
        ReactDOM.render(, document.getElementById('root'));
        serviceWorker.unregister()
    }
);

redux-firestore

Redux bindings for Firestore.

MIT
Latest version published 2 years ago

Package Health Score

70 / 100
Full package analysis