The ID of the project for which tags are fetched. Can be undefined
.
The object containing additional query parameters to refine the tag fetch request.
The object containing:
refresh
: FetchTagsMethod - Function to refresh the tags by re-fetching them from the backend.fetched
: A boolean flag indicating whether the user data has been fetched.tags
: The current list of tags fetched for the given projectId
and params
.withCache
to cache the tags for 5 minutes (300,000 ms).Error - If the tag fetching process fails, an error with the underlying cause is thrown.
import { useTags } from 'react-playmakers';
function ProjectTags(){
const { tags, fetched, refresh } = useTags('pXXXXXXXX', { page: 1 });
if (!fetched) {
return <div>Loading tags...</div>;
}
return (
<div>
<h2>Project Tags</h2>
{tags.length === 0 ? (
<p>No tags found for this project.</p>
) : (
<ul>
{tags.map((tag, index) => (
<li key={index}>{tag}</li>
))}
</ul>
)}
<button onClick={() => refresh()}>Refresh Tags</button>
</div>
);
}
Generated using TypeDoc
Custom React hook to fetch and manage tags for a specific project.