2017-12-01 42 views
1

背景:Cloud Firestoreと統合するために、反応ネイティブのfirebaseを反応系ネイティブで使用し始めました。私は、私のテストアプリケーションにreduxを導入するつもりです。反応ネイティブfirebase対反応redux firebase?

質問 - ここで私のライブラリーの選択肢として反応ネイティブFirebaseはいいですか? (対反応炉ベースへの移行)

2つのライブラリの違いをまとめて簡単にまとめることはできますか?私は反応ネイティブfirebaseとのインストールは、IOSとAndroidのために非常に関与しているので、私はリアクションredux firebaseがこれを簡単にするかどうかはわからないが、ミックスで何かを失うかどうかは分かりません。

答えて

2

主な違い:

react-redux-firebaseとFirebase JSのAPIを使用します。あなたはそのようreact-redux-firebaseにごFirebaseインスタンスとしてそれを提供できることを意味し、フードの下のネイティブ・モジュールを使用している間react-native-firebaseFirebase JS APIを提供しています。

import { compose, createStore } from 'redux'; 
import RNFirebase from 'react-native-firebase'; 
import { getFirebase, reactReduxFirebase } from 'react-redux-firebase'; 
import thunk from 'redux-thunk'; 
import makeRootReducer from './reducers'; 

const reactNativeFirebaseConfig = { 
    debug: true 
}; 

const reduxFirebaseConfig = { 
    userProfile: 'users', // save users profiles to 'users' collection 
}; 

export default (initialState = { firebase: {} }) => { 
    // initialize firebase 
    const firebase = RNFirebase.initializeApp(reactNativeFirebaseConfig); 

    const store = createStore(
    makeRootReducer(), 
    initialState, 
    compose(
     reactReduxFirebase(firebase, reduxFirebaseConfig), // pass initialized react-native-firebase app instance 
    // applyMiddleware can be placed here 
    ) 
); 

    return store; 
}; 

この設定とそれ以上はreact-native recipes section of the docsで覆われています。

免責事項:私は返信用react-redux-firebase

+0

感謝の著者の一人といくつかの物事をクリアしています。これとは別に、2つの図書館のいずれかが火災の例外を異なる方法で処理するかどうかを知ることはできません。私はちょうど私がここに持っている1つの問題を提起しました:https://github.com/invertase/react-native-firebase/issues/727 – Greg

+0

あなたが実行しているアクションを許可しないルールでエラーが発生しているように見えます。あなたはあなたのルールがあなたがやっていることをすることを許可していることを確認しましたか?サブコレクションを含める? Firestoreの使用もサポートされていますが、[react-redux-firebase](http://react-redux-firebase.com/docs/firestore.html)でもサポートされています。 – Scott

関連する問題