Michael Zhang Michael Zhang - 3 months ago 58
React JSX Question

re-render when update this.props.location.query.somequery Reactjs

render() function will fire when this.props.location.query.someQuery updated. But I do not want re-render the component when updated query.
The way I updated query is following:

this.props.location.query.someQuery = otherValue;


Take a look at the react lifecycle.

You should implement a method called shouldComponentUpdate().

Use this as an opportunity to return false when you're certain that the transition to the new props and state will not require a component update.

This method will be called each time React thinks your component should update, if you don't want it to re-render under certain conditions, check for those conditions and then return false in this function.