Advertisement
Guest User

Untitled

a guest
Aug 25th, 2016
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. import StateProxy from "./state-proxy";
  2.  
  3. const {params, dispatch, state} = this.props,
  4. {organization, trip} = params;
  5.  
  6. // Proxy objects are light-weight & contain very little of own state. Just a mechanism for
  7. // traversing a state tree.
  8. // Only StateProxy instance holds reference to state tree.
  9. // The idea is it would be created after memoized selectors are run in mapStateToProps() or render().
  10. let stateProxy = new StateProxy(dispatch, state),
  11. tripProxy = stateProxy.trip(organization, trip),
  12. // Traversing relationship; returns a RecordProxy object.
  13. recordProxy = tripProxy.tripDetail();
  14.  
  15. console.log(tripProxy.data(), recordProxy.data());
  16.  
  17. for (tripProxy of stateProxy.trips(organization)) {
  18. console.log(tripProxy.data(), tripProxy.tripDetail().data());
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement