Guest User

Untitled

a guest
May 23rd, 2018
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. shouldComponentUpdate: function(nextProps, nextState) {
  2. if(this.props.route.path == nextProps.route.path) return false;
  3. return true;
  4. }
  5.  
  6. // history.js
  7. import { createBrowserHistory } from 'history'
  8. export default createBrowserHistory()
  9.  
  10. // XYZ.js
  11. import React from 'react';
  12. import history from './history'
  13.  
  14. class XYZ extends React.Component {
  15. _handleClick() {
  16. # this should not cause rerender and still have URL change
  17. history.push("/someloc");
  18. }
  19. render() {
  20. return(
  21. <button onClick={this._handleClick.bind(this)}>test </button>
  22. )
  23. }
  24. }
Add Comment
Please, Sign In to add comment