INNER CODE UNIT · JavaScript

defaultSortFn

fullstackreact/react-native-firestack · lib/firestackModule.js:26

const defaultSortFn = (a, b) => a.timestamp < b.timestamp
const defaultInitialState = {
  items: [],
}

export class FirestackModule {
  constructor(refName, opts={}) {
    invariant(refName && typeof refName !== 'undefined', 'No ref name passed');
    
    this._refName = refName;
    this._makeRef = opts.makeRef || identity;

    const initialState = Object.assign({}, opts.initialState || defaultInitialState, {
      listening: false,
      items: []
    })

    this._localState = initialState;

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…