JSFiddle - React, Tailwind, and code Playground

HTML

<select class="selectPageSum">
    <option value="5">5 фильмов на страницу</option>
    <option value="10">10 фильмов на страницу</option>
    <option value="25">25 фильмов на страницу</option>
    <option value="50">50 фильмов на страницу</option>
    <option value="100">100 фильмов на страницу</option>
</select>

JavaScript

function getCookie(a) {
    var b = a + "=";
    var d = document.cookie.split(';');
    for (var i = 0; i < d.length; i++) {
        var c = d[i];
        while (c.charAt(0) == ' ') {
            c = c.substring(1, c.length);
        }
        if (c.indexOf(b) == 0) {
            return c.substring(b.length, c.length);
        }
    }
    return null;
}

function setCookie(a, b, c) {
    if (c) {
        var d = new Date();
        d.setTime(d.getTime() + (c * 24 * 60 * 60 * 1000));
        var e = "; expires=" + d.toGMTString();
    } else {
        var e = "";
    }
    document.cookie = a + "=" + b + e + "; path=/";
}

$(function () {
    $(".selectPageSum").change(function () {
        var a = ""
        $(".selectPageSum option:selected").each(function () {
            a = $(this).val();
        });
        setCookie("selectpagesum", a, 365);
        location.reload();
    });
});

$(document).ready(function () {
    var a = 0,
        b = 0;
    if (!getCookie("selectpagesum")) {
        setCookie("selectpagesum", 10, 365);
    }
    $(".selectPageSum option").each(function () {
        if (getCookie("selectpagesum") == $(this).val() && b == 0) {
            a = a + 1;
            b = 0 + 1;
        } else if (b == 0) {
            a = a + 1;
        }
    });
    $(".selectPageSum").prop('selectedIndex', a-1);
});