0.0.5 • Published 2 years ago
react-cookie-clicker v0.0.5
React Cookie Clicker 🍪
Click cookie and be rewarded with more cookies! 🎉
Installation
Install the package while inside your project directory with the following:
npm install react-cookie-clicker
// OR
yarn add react-cookie-clicker
Usage
import CookieClicker from 'react-cookie-clicker';
export default function App() {
return (
<>
<CookieClicker />
<p>Click the cookie!</p>
<>
);
}
SSR with Next.js
This package only works in the browser and does not currently support server-side rendering (SSR). If you want to use it in a Next.js application, which prefetches dynamic content by default, use their dynamic import functionality without SSR.
import dynamic from 'next/dynamic';
const CookieClicker = dynamic(() => import('react-cookie-clicker'), {
ssr: false
});
const App = () => {
return (
<div style={{ marginTop: 150 }}>
<CookieClicker />
<h2>Click the cookie</h2>
</div>
);
};
export default App;
Props
The CookieClicker
component accepts the following props:
Name | Type | Description |
---|---|---|
count | number | Controls the number of rewarded cookies (default: 20 ) |
onClick | func | Optional callback function fired upon clicking button |
rewardConfig | object | Configuration options for react-rewards |