title: React+Firebase. Write to Database after Authentication
body: <p>I'm currently setting up Firebase for my React Native app. Authentication &amp; basic writing/reading work fine. 
  Though, I struggle to write data to the database right after the initial authentication because my "<code>signUp</code>" and "<code>writeUserData</code>" functions execute at the same time (and at this moment there is no <code>userId</code> yet). </p>
  
  <p>Here is my code:</p>
  
  <pre><code>...
  
  module.exports = React.createClass({
    getInitialState(){
      return({
        email: '',
        password: '',
        confirmPassword: '',
        result: '',
      })
    },
  
    signUp() {
      if (this.state.password === this.state.confirmPassword) {
        let {email, password} = this.state;
        firebaseApp.auth().createUserWithEmailAndPassword(email, password)
        .catch(error =&gt; this.setState({result: error.message
        }));
        this.writeUserData(email);
      } else {
        this.setState({result: 'Passwords do not match.'})
      }
    },
  
    writeUserData(email) {
      let userId = firebaseApp.auth().currentUser.uid;
      firebase.database().ref('users/' + userId + '/').set({
          info: {
            firstName: 'Jonas',
            email: email,
          },
          currentState: {
            currentDay: 0,
            currentSeries: 0,
          }
      });
    },
    render() {
  ...
  </code></pre>
  
  <p>I can't find any good documentation about this. Can someone give me a pointer?
  Thanks!</p>