Guest User

Untitled

a guest
Sep 18th, 2018
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.36 KB | None | 0 0
  1. ...
  2.  
  3. static getDerivedStateFromProps(nextProps, prevState) {
  4. // Store prevId in state so we can compare when props change.
  5. // Clear out previously-loaded data (so we don't render stale stuff).
  6. if (nextProps.id !== prevState.prevId) {
  7. return {
  8. externalData: null,
  9. prevId: nextProps.id
  10. };
  11. }
  12.  
  13. // No state update necessary
  14. return null;
  15. }
  16.  
  17. ...
Add Comment
Please, Sign In to add comment