I have an implementation of single page application using React, React router and Redux. It uses universal rendering.
There is a React component ArticleListComponent which displays a list of news articles.
On clicking the back button of the mobile browser, the React lifecycle function componentWillReceiveProps compares the route from current props and nextProps (shown in snippet below) and data is fetched accordingly.
componentWillReceiveProps (nextProps) {
var prevUrlParam = this.props.match.params;
var nextUrlParam = nextProps.match.params;
if(prevUrlParam === nextUrlParam) {
return;
}
// else data fetch for previous page
}
According to documentation (https://facebook.github.io/react/docs/react-component.html#componentwillreceiveprops) , componentWillReceiveProps is called only when the mounted component receives new props. This holds true for all mobile browsers, except for UC browser.
On UC browser, on first load of the server rendered page, after the component is mounted, componentWillReceiveProps is called and (prevUrlParam === nextUrlParam) is found to be false, causing data to be fetched.
Is the React lifecycle functions working differently for different browsers or is this a bug with respect to UC browser?