All components - update correctly on both prop create and update

This commit is contained in:
2018-03-23 00:39:49 +05:30
parent 1ffb373d2b
commit 508c034276
4 changed files with 44 additions and 10 deletions
@@ -19,6 +19,14 @@ export class NextOpenCloseMini extends React.Component<NextOpenCloseMiniProps, {
constructor(props: NextOpenCloseMiniProps) {
super(props);
this.updateFromProps(props);
}
componentWillUpdate(nextProps: NextOpenCloseMiniProps, nextState: {}) {
this.updateFromProps(nextProps);
}
updateFromProps(props: NextOpenCloseMiniProps) {
this.xDay = props.xDay;
this.openOrClose = props.openOrClose;
this.allHolidays = props.allHolidays;