Hyperlaunch

Hooks and Context

Custom Hooks

HyperLaunch includes several custom hooks to help you reuse state logic across your app. Notable examples include:

  • hooks/use-subscription-pricing: Manages pricing logic for subscription cards
  • hooks/use-email-collection: Handles email collection across different components

React Context

We use React Context to efficiently manage state across multiple components. The main context implementation:

Current User Context

  • Located in current-user-provider.tsx
  • Fetches user data from our Next.js backend
  • Provides access to user info, plans, and invoices

Usage Example

const { userInvoices, orders } = useContext(CurrentUserContext);

Note: This approach eliminates prop drilling and simplifies state management throughout your app.

On this page