
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
@souranalytics/react
Advanced tools
React package for Pickle analytics.
yarn add @souranalytics/react
Wrap your root component with PickleProvider
.
app/layout.tsx
pages/_app.tsx
index.tsx
import { PickleProvider } from '@souranalytics/react'
export default function MyApp() {
return (
<PickleProvider key="API_KEY">
{/* your app contents go here */}
</PickleProvider>
)
}
Then use the usePickle
hook anywhere in your app.
import { usePickle } from '@souranalytics/react'
export default function Page() {
const pickle = usePickle()
return (
<div>
<button onClick={() => pickle.event('hello')}>Event</button>
</div>
)
}
PickleProvider
Option | Type | Description | Required | Default |
---|---|---|---|---|
key | string | Project API key | Yes | - |
url | string | Override Pickle API endpoint | No | https://pickle.sh/api |
anonymousId | string | Override anonymous user id | No | cuid2 |
usePickle
const pickle = usePickle()
identify
pickle.identify(user: User | null, data?: UserProps)
Option | Type | Description | Required |
---|---|---|---|
user.id | string | User id | Yes |
user.name | string | User name | No |
user.email | string | User email | No |
data | object | User properties | No |
event
pickle.event(name: string | null, data?: EventProps)
Option | Type | Description | Required |
---|---|---|---|
name | string | Event name | Yes |
data | object | Event properties | No |
view
pickle.view(name: string | null, data?: ViewProps)
Option | Type | Description | Required |
---|---|---|---|
name | string | View name | Yes |
data | object | View properties | No |
If you have created a plan for your project on Pickle, you can use the Pickle CLI to generate TypeScript types for this library.
This will give you strong types for identify
, event
, and view
methods exposed by usePickle
.
FAQs
Pickle for React
The npm package @souranalytics/react receives a total of 0 weekly downloads. As such, @souranalytics/react popularity was classified as not popular.
We found that @souranalytics/react demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.