@exile-watch/encounter-data
Data that powers exile.watch
This package contains JSONs that power exile.watch.
This is ES module package only.
JSONs are generated based on the extracted YAML tokens. (more on the process here)
Usage
Install the package as a
dependency
:
npm i @exile-watch/encounter-data
Example of dynamically importing the data
// ListEncounterCategories.tsx
import { CategoryPageType } from "@exile-watch/encounter-data";
import { SimpleGrid } from "@exile-watch/writ-react";
import { useRouter } from "next/router";
import React, { useEffect, useState } from "react";
import { HomepageCard, SimpleCard } from "#components";
const ListEncounterCategories = () => {
const {
query: { directory, category },
} = useRouter();
const [data, setData] = useState<CategoryPageType | null>(null);
useEffect(() => {
import(
`@exile-watch/encounter-data/dist/extracted-data/${directory}/${category}.esm` as string
)
.then((d) => {
setData(d.default);
})
.catch(() => {
setData(null);
});
}, [category]);
return (
<SimpleGrid
cols={{ xxxl: 6, xxl: 5, xl: 4, lg: 3, md: 2, sm: 2, xs: 1 }}
mb="md"
>
{data?.map((data) => (
<HomepageCard key={data.path} {...data} />
))}
</SimpleGrid>
);
};
export default ListEncounterCategories;
Last updated
Was this helpful?