Open djmtype opened 1 year ago
OH… {t('data.products.0.slug')}
While this seems to work when mapping, VS Code doesn't seem to know its type, meaning I'm getting a warning that map
does not exist on type object
. Unsure if I'm implementing this correctly.
{t('data.products', { returnObjects: true }).map((product) =>
(
<p>{product.slug}</p>
)
)}
I used the Array constructor to call .map on non-array objects
Example:
{
Array.prototype.map.call(
t("data.products", { returnObjects: true }),
(product) => <p>{product.slug}</p>
)
}
This probably isn't a bug, but rather my lack of understanding. I have a nested array of objects. However,
{t("data.products[0].slug")}
doesn't even render. It returns as amissingKey
. What am I doing wrong?