# @exile-watch/encounter-data

## About [`@exile-watch/encounter-data`](https://github.com/exile-watch/nucleus/tree/main/packages/encounter-data)

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](/projects/nucleus/contributing-scripts/scripts-definition.md))

## Usage

{% hint style="info" %}
The size of generated JSONs can be big (double digit kb)

It's advised to dynamically import them when needed in order to boost performance
{% endhint %}

1. Install the package as a `dependency`:

```bash
npm i @exile-watch/encounter-data
```

***

2. Example of dynamically importing the data

<pre class="language-tsx"><code class="lang-tsx"><strong>// ListEncounterCategories.tsx
</strong><strong>import { CategoryPageType } from "@exile-watch/encounter-data";
</strong>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&#x3C;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 (
    &#x3C;SimpleGrid
      cols={{ xxxl: 6, xxl: 5, xl: 4, lg: 3, md: 2, sm: 2, xs: 1 }}
      mb="md"
    >
      {data?.map((data) => (
        &#x3C;HomepageCard key={data.path} {...data} />
      ))}
    &#x3C;/SimpleGrid>
  );
};

export default ListEncounterCategories;

</code></pre>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.exile.watch/projects/nucleus/exile-watch-encounter-data.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
