Installation
Get React Achievements up and running in your project.
Requirements
- React 17.0.0 or higher
- Node.js 16.0.0 or higher
- TypeScript 4.5.0 or higher (optional, but recommended)
Package Installation
Install React Achievements using your preferred package manager:
npm install react-achievements
That's it! React is automatically installed as a peer dependency by npm 7+.
Optional External Dependencies (Legacy UI)
Built-in UI Available
As of v3.6.0, React Achievements includes built-in UI components with no external dependencies. The legacy external dependencies below are optional and will be deprecated in v4.0.0.
If you're using existing code that relies on legacy external UI libraries, install them separately:
npm install react-toastify react-modal react-confetti react-use
Verifying Installation
Create a test file to verify the installation:
test-installation.tsx
import { AchievementProvider } from 'react-achievements';
function App() {
return (
<AchievementProvider achievements={{}}>
<div>React Achievements installed successfully!</div>
</AchievementProvider>
);
}
export default App;
If this compiles without errors, you're ready to go!
Next Steps
- Quick Start - Build your first achievement system
- Simple API Guide - Learn the recommended configuration approach
Troubleshooting
Module not found
If you get a "Module not found" error:
- Ensure React Achievements is listed in your
package.jsondependencies - Delete
node_modulesand runnpm installagain - Clear your bundler cache (e.g.,
rm -rf .next/cachefor Next.js)
TypeScript errors
If you encounter TypeScript errors:
- Ensure your TypeScript version is 4.5.0 or higher
- Add
"moduleResolution": "node"to yourtsconfig.json - Ensure you have
@types/reactinstalled:npm install --save-dev @types/react
React version conflicts
If you have React version conflicts:
npm install react-achievements --legacy-peer-deps
This installs the package while ignoring peer dependency conflicts.