def _init_var(cls, prop: Var):
        """Initialize a variable.

        Args:
            prop: The variable to initialize

        Raises:
            VarTypeError: if the variable has an incorrect type
        """
        from reflex.config import get_config
        from reflex.utils.exceptions import VarTypeError

        if not types.is_valid_var_type(prop._var_type):
            msg = (
                "State vars must be of a serializable type. "
                "Valid types include strings, numbers, booleans, lists, "
                "dictionaries, dataclasses, datetime objects, and pydantic models. "
                f'Found var "{prop._js_expr}" with type {prop._var_type}.'
            )
            raise VarTypeError(msg)
        cls._set_var(prop)
        if cls.is_user_defined() and get_config().state_auto_setters:
            cls._create_setter(prop)
        cls._set_default_value(prop)
Initialize a variable.

        Args:
            prop: The variable to initialize

        Raises:
            VarTypeError: if the variable has an incorrect type
        
reflex/state.py