Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
render() {
// server side rendering
let cookieValue;
if (this.context.ssr) {
cookieValue = `From_SSR_${Date.now()}`;
Cookies.set(COOKIE_NAME, cookieValue, this.context.ssr);
} else {
cookieValue = Cookies.get(COOKIE_NAME);
}
return (
<div>
<h6>Demo Non-Redux Universal Cookies</h6>
<p>Test cookie value: {cookieValue || ""}</p>
<input style="{{" type="text">
<button type="submit"> this._setCookie(x)}
>
Update Cookie
</button>
</div>
render() {
// server side rendering
let cookieValue;
if (this.context.ssr) {
cookieValue = `From_SSR_${Date.now()}`;
Cookies.set(COOKIE_NAME, cookieValue, this.context.ssr);
} else {
cookieValue = Cookies.get(COOKIE_NAME);
}
return (
<div>
<h6>Demo Non-Redux Universal Cookies</h6>
<p>Test cookie value: {cookieValue || ""}</p>
<input style="{{" type="text">
<button type="submit"> this._setCookie(x)}
>
Update Cookie
</button>
</div>
render() {
// server side rendering
let cookieValue;
if (this.context.ssr) {
cookieValue = `From_SSR_${Date.now()}`;
Cookies.set(COOKIE_NAME, cookieValue, this.context.ssr);
} else {
cookieValue = Cookies.get(COOKIE_NAME);
}
return (
<div>
<h6>Demo Non-Redux Universal Cookies</h6>
<p>Test cookie value: {cookieValue || ""}</p>
<input style="{{" type="text">
<button type="submit"> this._setCookie(x)}
>
Update Cookie</button></div>
render() {
// server side rendering
let cookieValue;
if (this.context.ssr) {
cookieValue = `From_SSR_${Date.now()}`;
Cookies.set(COOKIE_NAME, cookieValue, this.context.ssr);
} else {
cookieValue = Cookies.get(COOKIE_NAME);
}
return (
<div>
<h6>Demo Non-Redux Universal Cookies</h6>
<p>Test cookie value: {cookieValue || ""}</p>
<input style="{{" type="text">
<button type="submit"> this._setCookie(x)}
>
Update Cookie</button></div>
_refresh() {
this.setState({ cookie: Cookies.get(COOKIE_NAME, this.context.ssr) });
}
_refresh() {
this.setState({ cookie: Cookies.get(COOKIE_NAME, this.context.ssr) });
}
_setCookie(evt) {
evt.preventDefault();
const cookieValue = this.refs.newCookieValue.value;
this.refs.newCookieValue.value = "";
Cookies.set(COOKIE_NAME, cookieValue, this.context.ssr);
this._refresh();
}
_setCookie(evt) {
evt.preventDefault();
const cookieValue = this.refs.newCookieValue.value;
this.refs.newCookieValue.value = "";
Cookies.set(COOKIE_NAME, cookieValue, this.context.ssr);
this._refresh();
}
_expireCookie() {
Cookies.expire(COOKIE_NAME, this.context.ssr);
this._refresh();
}
_expireCookie() {
Cookies.expire(COOKIE_NAME, this.context.ssr);
this._refresh();
}