Skip to content
Amir Ariffin edited this page Mar 11, 2019 · 6 revisions

Store shape

app: {
  isSignedIn: <bool>,
  isStartupDone: <bool>,
  isWebsocketOnline: <bool>
},
authorization: {
  country_code: <string>
  phone_number: <string>,
  token: <string>
},
messages: {
  allIds: [<string>, ...],
  byId: {
    <string>: {
      message: <string>,
      sender: {
        country_code: <string>,
        phone_number: <string>
      }
    },
    ...
  }
},
profile: {
  userName: <string>
}

Middleware rules

  1. It shouldn't mutate any action
  2. It shouldn't filter any action
  3. It can dispatch n actions for any action
  4. It can complex contain state logic

Console log convention

  1. For logging errors, place pure string log before logging the error event
    • This will make string search for debugging purposes more robust
  2. Prepend log with __XXX__ where XXX is the log type
  3. Always use console.log for logging
Clone this wiki locally