mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2026-11-22 18:56:54 +00:00
PrintPage: Fix potentially inconsistent React state update
This commit is contained in:
1 parent
8d73ff6833
commit
e86ce5cf06
1 file changed
+3
-1
@@ -22,7 +22,9 @@ const PrintPage = createClass({
|
||||
|
||||
componentDidMount : function() {
|
||||
if(this.props.query.local){
|
||||
this.setState({ brewText: localStorage.getItem(this.props.query.local) });
|
||||
this.setState((prevState, prevProps) => ({
|
||||
brewText: localStorage.getItem(prevProps.query.local)
|
||||
}));
|
||||
}
|
||||
|
||||
if(this.props.query.dialog) window.print();
|
||||
|
||||
Reference in new issue
Block a user