跳到正文
cccskills
免费在 GitHub 公开

integration-react-react-router-6

PostHog integration for React Router v6 applications

中文简介正在准备中。当前显示原文说明。

查看安装方法

包含的文件(8)

  • SKILL.md2.9 KB
  • references/basic-integration-1.0-begin.md2.1 KB
  • references/basic-integration-1.1-edit.md2.5 KB
  • references/basic-integration-1.2-revise.md937 B
  • references/basic-integration-1.3-conclude.md1.6 KB
  • references/EXAMPLE.md13.5 KB
  • references/identify-users.md8.1 KB
  • references/react-router-v6.md11.6 KB

SKILL.md(原文)

安装前可以查看交给 AI 代理的指令内容。

PostHog integration for React Router v6

This skill helps you add PostHog analytics to React Router v6 applications.

Workflow

Follow these steps in order to complete the integration:

  1. basic-integration-1.0-begin.md - PostHog Setup - Begin ← Start here
  2. basic-integration-1.1-edit.md - PostHog Setup - Edit
  3. basic-integration-1.2-revise.md - PostHog Setup - Revise
  4. basic-integration-1.3-conclude.md - PostHog Setup - Conclusion

Reference files

  • references/EXAMPLE.md - React Router v6 example project code
  • references/react-router-v6.md - React router v6 - docs
  • references/identify-users.md - Identify users - docs
  • references/basic-integration-1.0-begin.md - PostHog setup - begin
  • references/basic-integration-1.1-edit.md - PostHog setup - edit
  • references/basic-integration-1.2-revise.md - PostHog setup - revise
  • references/basic-integration-1.3-conclude.md - PostHog setup - conclusion

The example project shows the target implementation pattern. Consult the documentation for API details.

Key principles

  • Environment variables: Always use environment variables for PostHog keys. Never hardcode them.
  • Minimal changes: Add PostHog code alongside existing integrations. Don't replace or restructure existing code.
  • Match the example: Your implementation should follow the example project's patterns as closely as possible.

Framework guidelines

  • For feature flags, use useFeatureFlagEnabled() or useFeatureFlagPayload() hooks - they handle loading states and external sync automatically
  • Add analytics capture in event handlers where user actions occur, NOT in useEffect reacting to state changes
  • Do NOT use useEffect for data transformation - calculate derived values during render instead
  • Do NOT use useEffect to respond to user events - put that logic in the event handler itself
  • Do NOT use useEffect to chain state updates - calculate all related updates together in the event handler
  • Do NOT use useEffect to notify parent components - call the parent callback alongside setState in the event handler
  • To reset component state when a prop changes, pass the prop as the component's key instead of using useEffect
  • useEffect is ONLY for synchronizing with external systems (non-React widgets, browser APIs, network subscriptions)

Identifying users

Identify users during login and signup events. Refer to the example code and documentation for the correct identify pattern for this framework. If both frontend and backend code exist, pass the client-side session and distinct ID using X-POSTHOG-DISTINCT-ID and X-POSTHOG-SESSION-ID headers to maintain correlation.

Error tracking

Add PostHog error tracking to relevant files, particularly around critical user flows and API boundaries.

评价

还没有评价。欢迎分享你的使用感受。

评论

无需登录即可发表。欢迎分享使用感受、提问,或说明在哪些环境下无法运行。

还没有评论。来写第一条吧。

提交后会立即公开。请勿填写邮箱、电话等个人信息。URL 最多 2 个。

0 / 1000 字

此表单受 reCAPTCHA 保护,适用 Google 的隐私权政策和服务条款。

同一仓库的技能

Skill for adding or updating educational algorithm guides, ensuring consistent patterns and simple explanations suitable for an 8-year-old.

中文简介正在准备中。当前显示原文说明。

rkmahale17/rulcode.com152026年10月12日 更新

Install and configure PostHog analytics SDK in React Native applications, including event tracking, feature flags, user identification, and error tracking. Use when the user needs to add PostHog analytics, session recording, or feature flags to a React Native app.

中文简介正在准备中。当前显示原文说明。

rkmahale17/rulcode.com152026年10月12日 更新

Develop and extend the RulCode technical interview preparation platform built with React, Vite, TypeScript, and Supabase. Use when adding new algorithm problems, building visualization components, implementing DSA topic pages, updating the problem editor, or modifying the interview preparation UI.

中文简介正在准备中。当前显示原文说明。

rkmahale17/rulcode.com152026年10月12日 更新

Scan the repository for hardcoded secrets, exposed API keys, insecure network configurations, and vulnerable dependencies. Use when the user asks for a security audit, secret detection, credential scan, vulnerability check, or wants to find leaked tokens in the codebase.

中文简介正在准备中。当前显示原文说明。

rkmahale17/rulcode.com152026年10月12日 更新

Skill for adding or updating system design guides tailored for college students and beginners, using simple analogies and no simulations.

中文简介正在准备中。当前显示原文说明。

rkmahale17/rulcode.com152026年10月12日 更新

React and Next.js performance optimization guidelines from Vercel Engineering. This skill should be used when writing, reviewing, or refactoring React/Next.js code to ensure optimal performance patterns. Triggers on tasks involving React components, Next.js pages, data fetching, bundle optimization, or performance improvements.

中文简介正在准备中。当前显示原文说明。

rkmahale17/rulcode.com152026年10月12日 更新

查看 rkmahale17 的全部技能

报告此技能的问题