evals
scenario-1
scenario-10
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
Build a URL state management utility that works across different React frameworks using appropriate adapters.
Create a utility that manages URL query parameters with support for multiple React framework environments:
Framework Adapter Setup: Configure a provider component that wraps your application and sets up the correct adapter for the framework environment (Next.js App Router, React SPA, or test environment).
Search State Hook: Implement a search query parameter (q) that:
Category Filter Hook: Implement a category filter parameter (category) that:
The solution should use the appropriate adapter for each environment: Next.js App Router adapter for Next.js apps, React adapter for SPAs, and testing adapter for unit tests. The provider component should wrap the application to enable URL state management hooks throughout the component tree.
?q=laptop @test?category=electronics @test/**
* Hook to manage search query state in the URL
* Returns [searchQuery, setSearchQuery] tuple
*/
export function useSearchQuery(): [string, (value: string) => void];
/**
* Hook to manage category filter state in the URL
* Returns [category, setCategory] tuple
*/
export function useCategoryFilter(): [string, (value: string) => void];
/**
* Component that wraps the application with the appropriate framework adapter
*/
export function AppProviders({ children }: { children: React.ReactNode }): React.ReactElement;Provides URL state management with framework-specific adapters.