firebaseを使ってWebアプリケーションを初期化した後、新しいデータをデータベースに追加します。{'title': 'hello world!'}。 database.ref().child('title')
を、私は奇妙なオブジェクトを得ました:それから私は、このデータを取得しよう firebaseからのデータ取得が機能しない
マイコード:
export class App extends Component {
constructor(props) {
super(props);
// Initialize Firebase
var config = {
apiKey: "&&&&&&&dbBJY_ie3CbXtnL6M6QBEL2JqWI",
authDomain: "&&&&&&&.firebaseapp.com",
databaseURL: "&&&&&test-61197.firebaseio.com",
storageBucket: "test-&&&&.appspot.com",
messagingSenderId: "7&&&1193299"
};
firebase.initializeApp(config);
// Get a reference to the database service
var database = firebase.database();
console.log(database.ref().child('title'));
}
login() {
console.log('login');
// Log the user in via Twitter
}
render() {
return (
<View style={styles.container}>
<Touchable style={styles.loginBtn} onPress={ this.login }>
<Text style={styles.loginBtnText}>login</Text>
</Touchable>
</View>
);
}
}
がどのように自分のデータを取得するには? Firebaseのバージョン:3.4.0
コードを表示できますか?私の推測では、そのオブジェクトに対して '.val()'を呼び出さなければならないということです。 – yihangho
はい、それは私のコードです:[jsfiddle link](https://jsfiddle.net/1mxc9zsg/) – Slava