Core React components and utilities with seamless Strapi integration.
npm install @spelyco/react-core
yarn add @spelyco/react-core
- useStrapiFind: Fetch multiple entries with pagination and filtering
- useStrapiFindOne: Fetch single entries efficiently
- useStrapiCreate: Create new entries with validation
- useStrapiUpdate: Update existing entries
- useStrapiDelete: Delete entries safely
- Mantine UI integration
- Responsive and accessible components
- Customizable theming
{
"@mantine/core": "^7.15.3",
"@mantine/dates": "^7.15.3",
"@mantine/hooks": "^7.15.3",
"@tabler/icons-react": "^7.15.3",
"@tanstack/react-query": "*",
"axios": "*",
"clsx": "*",
"dayjs": "*",
"react": ">=18.0.0",
"react-dom": ">=18.0.0",
"zustand": ">=5.0.0"
}
import { useStrapiFind, useStrapiCreate } from '@spelyco/react-core'
// Fetch posts with pagination
function PostsList() {
const { data, isLoading } = useStrapiFind('posts', {
pagination: { page: 1, pageSize: 10 },
sort: \['createdAt:desc'\]
})
if (isLoading) return
return (
{data?.data.map(post => (
<div>{post.attributes.title}</div>
))}
)
}
// Create a new post
function CreatePost() {
const { mutate, isLoading } = useStrapiCreate('posts')
const handleSubmit = (data) => {
mutate(data, {
onSuccess: () => {
console.log('Post created successfully!')
}
})
}
return (
{/\* Your form fields \*/}
)
}
# Install dependencies yarn install
yarn build
yarn dev
Package publishing is handled through GitHub Actions. See the root README for details.
MIT License - Create amazing things! 🚀