mirror of
https://github.com/Mastermindzh/react-cookie-consent.git
synced 2025-01-20 18:41:44 +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;
|
||||
|
||||
// if debug desired or cookieName undefined
|
||||
if (debug || Cookies.get(cookieName) === undefined) {
|
||||
// if cookie undefined or debug
|
||||
if (Cookies.get(cookieName) === undefined || debug) {
|
||||
this.setState({ visible: true });
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user