The specific state to filter schemas by.
Optional
params: { Optional parameters for customizing the schema fetch behavior
(e.g., page
, limit
, or other query parameters).
Returns the filtered schemas and other state management methods from UseSchemasReturn.
import { useSchemasByState } from 'react-playmakers';
const MyComponent = () => {
const { schemas, fetched, fetchMore, refresh } = useSchemasByState('active', { limit: 10 });
useEffect(() => {
if (!fetched) {
console.log('Fetching schemas...');
}
}, [fetched]);
return (
<div>
<h1>Active Schemas</h1>
<ul>
{schemas.map(schema => (
<li key={schema.id}>{schema.name}</li>
))}
</ul>
{fetchMore && <button onClick={fetchMore}>Load More</button>}
<button onClick={refresh}>Refresh</button>
</div>
);
};
Generated using TypeDoc
Hook for fetching and filtering schemas by a specific state.
This hook extends the
useSchemas
hook by adding a filtering layer to only return schemas that match a specific state. It passes additional parameters touseSchemas
and refines the schema list based on the provided state.