Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- shouldComponentUpdate: function(nextProps, nextState) {
- if(this.props.route.path == nextProps.route.path) return false;
- return true;
- }
- // history.js
- import { createBrowserHistory } from 'history'
- export default createBrowserHistory()
- // XYZ.js
- import React from 'react';
- import history from './history'
- class XYZ extends React.Component {
- _handleClick() {
- # this should not cause rerender and still have URL change
- history.push("/someloc");
- }
- render() {
- return(
- <button onClick={this._handleClick.bind(this)}>test </button>
- )
- }
- }
Add Comment
Please, Sign In to add comment