Optional id: stringThe returning object contains:
questType: The current quest type object.fetched: Boolean indicating whether the quest type has been successfully
fetched.refresh: FetchQuestTypeMethod - Function to refetch the quest type.getQuestType responses are cached for 5 minutes (300,000 ms) using
withCache to reduce redundant API calls. Cache is cleared when refresh is triggered.useEffect hook triggers fetchQuestType whenever the id
changes, ensuring the correct quest type is fetched.questType: Holds the fetched quest type data or null if not yet fetched.fetched: Tracks whether the fetch process has completed.fetchQuestType: Fetches the quest type using the provided id. Optionally accepts a
quiet flag to suppress loading state updates and a refresh flag to bypass the cache.import { useQuestType } from 'react-playmakers';
const QuestDetails = () => {
const { fetched, questType, refresh } = useQuestType('qXXXXXXX');
if (!fetched) {
return <div>Loading...</div>;
}
if (!questType) {
return <div>No quest type found.</div>;
}
return (
<div>
<h1>{questType.name}</h1>
<p>{questType.description}</p>
<button onClick={() => refresh(true)}>Refresh</button>
</div>
);
};
export default QuestDetails;
Generated using TypeDoc
Custom React hook to manage quest type.