Trabajando en React tengo este problema....
Tengo el siguiente componente:
const VolcanoDateField = (props) => {
const { date, format } = props;
const { i18n } = useTranslation();
const datetime = new Date(date);
const getDateString = (short) => {
let stringDate = "";
if (datetime !== undefined) {
stringDate = Intl.DateTimeFormat(i18n.language, {
timeZone: "Europe/London",
year: "numeric",
month: short ? "2-digit" : "long",
day: "2-digit",
}).format(datetime);
}
return stringDate;
};
const getTimeString = () => {
let stringTime = "";
if (datetime !== undefined) {
stringTime = Intl.DateTimeFormat(i18n.language, {
timeZone: "Europe/London",
hour12: false,
hour: "numeric",
minute: "numeric",
second: "numeric",
}).format(datetime);
}
return stringTime;
};
const buildObjectFromDate = () => {
switch (format) {
case constants.SHORT_DATETIME:
return (
<div>
{getDateString(true)}
<br />
{getTimeString()}
</div>
);
break;
case constants.LONG_DATETIME:
return (
<div>
{getDateString(false)}
<br />
{getTimeString()}
</div>
);
break;
case constants.ONLY_DATE:
return <div>{getDateString(true)}</div>;
break;
case constants.ONLY_LONG_DATE:
return <div>{getDateString(false)}</div>;
break;
case constants.ONLY_TIME:
return <div>{getTimeString(false)}</div>;
break;
default:
return "";
}
};
return (
buildObjectFromDate()
);
};
Según entiendo todo está bien y retorna lo adecuado (string o JSX) pero cuando intento invocarlo así:
<MyDateField date={entity} format={constants.SHORT_DATETIME} />
El navegador devuelve el siguiente error:
React.createElement: type is invalid --
Hola amigos, vengo a consultaros. En algunas páginas en el banner de cookies, hay un apartado de configurar las cookies. Me pregunta es dónde se almacenan los valores que selecciona el usuario en esa configuración. He estado revisando el localStorage de algunas páginas que lo piden y no almacenan nada ahí. No sé si alguien puede ayudarme y darme una idea.
Gracias.
id 317418788Photo
Allí te dice q no estas autorizado. Seguro que envias el token correctamente?
Donde tienes guardado ese token?
C I G I G