O'Reilly logo

React Native Blueprints by Emilio Rodriguez Martinez

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Users store

This store is responsible for holding all the data and logic surrounding users, but also helps the chats store initializing when a user is logged in:

/*** src/stores/users.js ***/import {observable, computed, map, toJS, action} from 'mobx'; import chats from './chats' import firebase from 'firebase'; import { firebaseApp } from '../firebase'; import notifications from '../notifications' class Users { @observable id = null; @observable isLoggedIn = false; @observable name = null; @observable avatar = null; @observable notificationsToken = null; @observable loggingIn = false; @observable registering = false; @observable loggingError = null; @observable registeringError = null; @action login = function(username, password) { //login ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required