@spelyco/react-core
TypeScript icon, indicating that this package has built-in type declarations

1.0.0-beta.20250123161348 • Public • Published

@spelyco/react-core

Core React components and utilities with seamless Strapi integration.

npm version

⚡️ Quick Install

npm install @spelyco/react-core
yarn add @spelyco/react-core

🎯 Features

Strapi Integration

  • 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

UI Components

  • Mantine UI integration
  • Responsive and accessible components
  • Customizable theming

📋 Requirements

{
  "@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"
}

💡 Usage

Strapi Hooks

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 \*/}
  )
}

🛠️ Development

# Install dependencies yarn install

Build package

yarn build

Development mode

yarn dev

📦 Publishing

Package publishing is handled through GitHub Actions. See the root README for details.

📄 License

MIT License - Create amazing things! 🚀

Readme

Keywords

none

Package Sidebar

Install

npm i @spelyco/react-core

Weekly Downloads

0

Version

1.0.0-beta.20250123161348

License

none

Unpacked Size

866 kB

Total Files

8

Last publish

Collaborators

  • ynssenem