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