mirror of
https://github.com/Mastermindzh/react-cookie-consent.git
synced 2025-02-01 08:12:34 +01:00
Moving to componentdidmount
ComponentWillMount is bound to be deprecated (hence UNSAFE) in the new React version so switching to componentDidMount is a solid plan.
This commit is contained in:
parent
ecdf88a7e9
commit
36a8fae2b9
@ -43,11 +43,11 @@ class CookieConsent extends Component {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
componentWillMount() {
|
componentDidMount() {
|
||||||
const { cookieName, debug } = this.props;
|
const { cookieName, debug } = this.props;
|
||||||
|
|
||||||
// if debug desired or cookieName undefined
|
// if cookie undefined or debug
|
||||||
if (debug || Cookies.get(cookieName) === undefined) {
|
if (Cookies.get(cookieName) === undefined || debug) {
|
||||||
this.setState({ visible: true });
|
this.setState({ visible: true });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user