JSPM

react-incremental-library

0.0.2
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 1
  • Score
    100M100P100Q16463F
  • License MIT

A React library for incremental, idle, and clicker games. Build high-performance, engaging experiences with minimal setup.

Package Exports

  • react-incremental-library
  • react-incremental-library/dist/cjs/index.js
  • react-incremental-library/dist/esm/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (react-incremental-library) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

đŸ•šī¸ React Incremental Game Library

A collection of high-performance React hooks designed for incremental, clicker, and idle games. 🚀

✨ Features

  • Auto-incrementing resources
  • Achievements tracking
  • Clicker mechanics
  • Game loop management
  • Idle progression
  • Resource caps & multipliers
  • And more to come!

đŸ“Ļ Installation

[npm | bun | yarn | pnpm] add react-incremental-library

đŸ› ī¸ Usage

Each hook is designed with simplicity and flexibility in mind. Here are a few usage examples:

🔄 Game Loop (useGameLoop)

Runs a function at a fixed FPS to handle frame-based updates.

import { useGameLoop } from "react-incremental-library";

useGameLoop({
  fps: 60,
  update: () => console.log("Game loop running!"),
});

đŸ–ąī¸ Clicker (useClicker)

Manages a click-based resource.

import { useClicker } from "react-incremental-library";

const { count, handleClick } = useClicker({
  onClick: (val) => console.log("Clicked!", val)
});

đŸŽ–ī¸ Achievements (useAchievement)

Tracks when a condition is met and unlocks achievements.

import { useAchievement } from "react-incremental-library";

const { unlocked } = useAchievement({
  name: "First Click",
  condition: clicks >= 1,
  onUnlock: () => console.log("Unlocked!")
});

đŸ”ŧ Auto-Increment (useAutoIncrement)

Increases currency automatically over time.

import { useAutoIncrement } from "react-incremental-library";

const { pause, resume, isPaused } = useAutoIncrement({
  interval: 1000,
  increaseBy: 5,
  onAutoIncrement: (amount) => console.log(`Gained ${amount}!`)
});

💰 Resource Cap (useResourceCap)

Prevents resources from exceeding a maximum limit.

import { useResourceCap } from "react-incremental-library";

const { resource, addResource, removeResource } = useResourceCap({
  initialValue: 50,
  max: 100
});

💤 Idle Progress (useIdleProgress)

Rewards players for time spent away.

import { useIdleProgress } from "react-incremental-library";

const { idleGain } = useIdleProgress({ resourcePerSecond: 2 });
console.log(`You gained ${idleGain} resources while away!`);

📄 API Documentation

The following table lists the hooks available in the library. This list is designed to update automatically as new hooks and features are added. For a detailed look at each hook, please visit our examples folder.

Hook Description
useGameLoop Runs a function at a fixed FPS.
useClicker Manages click-based interactions.
useAchievement Unlocks achievements when conditions are met.
useAchievements Tracks multiple achievements.
useAutoIncrement Automates resource accumulation over time.
useResourceCap Prevents resources from exceeding max limits.
useIdleProgress Rewards players for offline time.
useMultiplier Applies multipliers to resource generation.
useSaveGame Saves game state to local storage.
useLoadSaveGame Loads saved game state from local storage.
useTick Calls a function at a set interval.
useCooldown Implements cooldown mechanics for actions.
useUpgrade Handles game upgrades and purchases.

🎮 Contributing

PRs are welcome! If you have an idea for a new hook or an improvement, feel free to submit a request or open an issue. For usage examples, please refer to our examples folder.


âš–ī¸ License

MIT License Š 2025 - Tommy Danks


🚀 Start Building Your Incremental Game Today!



â¤ī¸

Reminder that you are great, you are enough, and your presence is valued. If you are struggling with your mental health, please reach out to someone you love and consult a professional. You are not alone; there is a large range of resources online for support and guidance.